• Thanks for the great plugin. I’m using it (1.9.4) to make a list of fieldsets. So I have this:

    [slider_group_fieldset]
    type = fieldset_open
    legend = Fieldset
    multiple = true
    multipleButton = true

    [slider_group_title]
    type = text
    label = Title
    blank = true

    [slider_group_description]
    type = textarea
    label = Description
    cols = 100
    blank = true

    [slider_group_state]
    type = radio
    label = Should the slider be open or closed on page load?
    value = open # closed

    [slider_group_order]
    type = text
    label = Order
    blank = true

    [slider_group_fieldset]
    type = fieldset_close

    This works fine for the first instance. When I click “add new” it correctly creates a new instance and I can enter text into the text fields but when I click the radio button for the state it affects the radio button for the previous instance. If I save and reload the page the radio button works as expected. Any ideas what’s going on here or where to start investigating?

    Thanks,
    Colin

    http://wordpress.org/extend/plugins/custom-field-template/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter ColinD

    (@colind)

    Starting to get a handle on this. The first instance present a form like so:

    <fieldset>
    <input type="hidden" value="1" name="slider_group_fieldset[]">
    <legend>
    <dl id="dl_slider_group_title1_0" class="dl_text">
    <dl id="dl_slider_group_description2_0" class="dl_textarea">
    <dl id="dl_slider_group_state3_0" class="dl_radio">
    <dl id="dl_slider_group_order4_0" class="dl_text">
    </fieldset>

    When I make a new instance it presents the form:

    <fieldset>
    <input type="hidden" value="" name="slider_group_fieldset[]">
    <legend>
    <dl id="dl_slider_group_title1_1" class="dl_text">
    <dl id="dl_slider_group_description2_1" class="dl_textarea">
    <dl id="dl_slider_group_state3_0" class="dl_radio">
    <dl id="dl_slider_group_order4_0" class="dl_text">
    </fieldset>

    So the problem is that all my subsequent fieldsets have the wrong ID set for their state and order inputs.

    Anyone have any ideas where this js is constructed in the plugin?

    I’ll keep digging…

    Colin

    Thread Starter ColinD

    (@colind)

    OK. I got it. So there’s an error in custom-field-template.php.

    The code in question is part of the function load_custom_field() and the real issue starts at line 2200.

    First, remove:
    tmp.find('."'p'".').remove();
    (I couldn’t find any valid reason to remove the paragraphs)

    Next, within
    jQuery(this).find('."'input'".').each(function(){
    there are several ‘id’, ‘name’, and ‘for’ attr().replace()
    Each needs to be enclosed in an if() that checks that the object has that attribute that is going to be replaced.

    I’d post a patch but I don’t see how to attach a file here. Ping me if you’d find it helpful.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘[Plugin: Custom Field Template] strange radio button behavior’ is closed to new replies.