Home › Forums › Backend Issues (wp-admin) › showNotice on repeater field. › Reply To: showNotice on repeater field.
@hube2 John, Yes! That’s it! Thanks. I’ve re-wrote it to make a function that does exactly the same like acf.getField() for fields on the same .acf-row.
This is the result:
You get it with:
var $fieldTarget = rtt_getRowField( $input, $fieldTarget_key );
function rtt_findClosestAcfRow( $el ){
return $el.closest('.acf-row');
}
function rtt_findInputField( $el, $key ){
return $el.find('[data-key="'+ $key +'"] input');
}
function rtt_findClosestField( $el ){
return $el.closest('.acf-field');
}
function rtt_getClosestField( $el ){
var $field = rtt_findClosestField( $el );
return acf.getField( $field );
}
function rtt_getRowField($el, $key){
var $acfRow = rtt_findClosestAcfRow( $el );
var $inputField = rtt_findInputField( $acfRow, $key);
return rtt_getClosestField( $inputField );
}
Ah yes, I’ve replaced
return $el.find('[data-key="'+ $key +'"] input.hasDatepicker');
to this and removed “hasDatepicker”
return $el.find('[data-key="'+ $key +'"] input');
This way I can reuse the code to address all the input fields on the same row.
Now you can use all the acf.functions 🙂 🙂
Once again, thanks John for your time and knowledge
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.