Support

Account

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