Hi,
is it possible to populate a textfield inside a repeater, but every time i add a row, the value is different.
Right now, the value is the same, every time i add a row.
function my_acf_load_field( $field ) {
$rndnumber = random_int(100, 999);
$field['default_value'] = $rndnumber;
return $field;
}
//field_5c88dd5d00e5c is the textfield inside the repeater
add_filter('acf/load_field/key=field_5c88dd5d00e5c', 'my_acf_load_field');
Ok, got it. You do it via the JS Hooks 🙂
acf.addAction('append_field/key=field_5c88dd5d00e5c', append_field);
function append_field($el){
$el.val(Math.random());
$el.disable();
}