Support » Plugin: Advanced Custom Fields » [Plugin: Advanced Custom Fields] 2.0.0 JS bug when clicking "Add Field"

Viewing 1 replies (of 1 total)
  • This is due to the “id” field not set on the fields to begin with so id is not properly set in the line
    var id = $(this).attr(‘id’);

    Therefore the lines id=id.replace(…. fail.
    I didn’t have time to see if the “id” and “name” were both needed or why they “id” was not set when the create_field function calls the appropriate core/fields/ file but to make things simple I just commented out the following lines lines in $.fn.update_names functions.fields.js

    var id = $(this).attr(‘id’);
    id= id.replace(‘[sub_fields][999]’,'[sub_fields][‘+new_sub_no+’]’);

    Then at the bottom
    instead of $(this).attr(‘id’, id);
    I set this:
    $(this).attr(‘id’, name);

    hence I am making the name and ID fields the same.

    I understand that what should happen is that the core templates should properly set the default id value and/or the javascript line:
    var id = $(this).attr(‘id’);

    should use some sort of if statement and maybe set the id to the name initially if it is null instead …

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Advanced Custom Fields] 2.0.0 JS bug when clicking "Add Field"’ is closed to new replies.