Support

Account

Home Forums Add-ons Repeater Field JS "append" action and some value in new field Reply To: JS "append" action and some value in new field

  • For some reason I thought that I should give the value to $field object, just didn`t know to what key.

    At this moment I ended with this

    acf.add_action('append', function( $el ){
            /* $el will be equivalent to the new element being appended $('tr.row') */
            var setvalue = jQuery('#post_ID').val() + 'h' + (new Date().getTime()).toString(36);
            var $row = $el.closest('.acf-row');       
            $row.find('.acf-field-5995fe2ea9aad input').val(setvalue);
        });

    to add new value to the field. It shows the value in field.
    Important – I add disabled attribute to the field via JS and it was not saved to database, be careful.