• It looks like since a recent update, the form fields in my forms are not accepting the id property – only the HTML name is being set, but not the ID. I have custom javascript that is referencing those IDs that is no longer working because of this. The form fields are setup similar to this:

    [select* player-jersey-one id:player-jersey-one include_blank “Adult XS|37.50” “Adult SM|37.50” “Adult M|37.50” “Adult LG|37.50” “Adult XL|37.50” “Adult XXL|37.50” “N/A|0.00”]

    I saw a patch note for 5.8 about the ID field being ignored if there is a duplicate, but I confirmed that all my IDs are unique on both of the forms in question.

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    I have custom javascript that is referencing those IDs

    What script is it?

    Thread Starter abelonger

    (@abelonger)

    Pretty straightforward script to set some hidden fields (I have some pricing dropdowns that have similar number values but different descriptions that I have to save separately)

    jQuery(document).ready(function() {
        jQuery('[id^="player-"]').each(function() {
            if(jQuery(this).val() != "")
            {
                setValue(this);
            }
        });
    });
    jQuery(function() {
        jQuery('[id^="player-"]').change(function() {
            setValue(this);
        });
    });
    function setValue(dropdown)
    {
        var selectId = '#hidden-' + jQuery(dropdown).attr('id');
        var value = jQuery(dropdown).val();
        jQuery(selectId).val(value);
    }

    I was able to get it working again by referencing the name attribute instead – but I am curious if the removal of the ID was intentional or not (or if I can add it back with a different change in the form)

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    See Editing form template

    What content do you have in the Form tab panel?

    Thread Starter abelonger

    (@abelonger)

    Here is a snippet of the form – I use the hidden fields to store the first value in a separate form field. This allows me to use those fields in the e-mail as well as actually store them in the database (otherwise it is only storing the selected value).

    <div>
        <div class="half last">Jersey #1 Size *[select* player-jersey-one id:player-jersey-one include_blank "Adult XS|37.50" "Adult SM|37.50" "Adult M|37.50" "Adult LG|37.50" "Adult XL|37.50" "Adult XXL|37.50" "N/A|0.00"]</div>
        <div class="half last">Jersey #2 Size *[select* player-jersey-two id:player-jersey-two include_blank "Adult XS|37.50" "Adult SM|37.50" "Adult M|37.50" "Adult LG|37.50" "Adult XL|37.50" "Adult XXL|37.50" "N/A|0.00"]</div>
    </div>
    <div>
        <div class="half">Helmet Size *[select* player-helmet id:player-helmet include_blank "Junior (SM)|70.00" "Senior (LG)|70.00" "N/A|0.00"]</div>
        <div class="half last">Pants Size *[select* player-pants id:player-pants include_blank "Child SM|35.00" "Child M|35.00" "Child LG|35.00" "Child XL|35.00" "Adult XS|35.00" "Adult SM|35.00" "Adult M|35.00" "Adult LG|35.00" "Adult XL|35.00" "Adult XXL|35.00" "N/A|0.00"]</div>
    </div>
    <div>
        <div class="half">Payment Type *[select* player-payment-type id:player-payment-type include_blank "Paypal|1" "Check|0"]</div>
    </div>
    
    [hidden hidden-player-helmet id:hidden-player-helmet]
    [hidden hidden-player-jersey-one id:hidden-player-jersey-one]
    [hidden hidden-player-jersey-two id:hidden-player-jersey-two]
    [hidden hidden-player-pants id:hidden-player-pants]
    
    [hidden hidden-player-payment-type id:hidden-player-payment-type]
    

    I did find info in the documentation about using [_raw_{field name}] but I suspect that would only be for the e-mail and wouldn’t actually store the value in the database, is that correct?

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    This allows me to use those fields in the e-mail as well as actually store them in the database (otherwise it is only storing the selected value).

    I’m not sure what you mean by this. Can you clarify that?

    Anyway, I could confirm that any of the id: options set in the form-tags are actually not appearing in the HTML source. Maybe you should tackle this problem first. My guess is that some of other plugins are intervening. What other plugins and theme do you use on the site?

    Thread Starter abelonger

    (@abelonger)

    I have a couple contact form database plugins that won’t store both the name and the value selected for those dropdowns – so for example, if the user selects “Adult SM” for the player-jersey-one field, it will store “37.50”. But since that value is actually on a few of the selections, I wouldn’t know which one was truly selected. So I use a hidden field to store the first part of the pipe.

    I am using a handful of plugins related to the contact forms – ACF7 DB User Access, Advanced CF7 DB, CF7 Skins, Conditional Fields for Contact Form 7, Paypal & Stripe Add-on, and Contact Form DB. My theme is a relatively old one that is no longer in development. Has anything changed recently with the id: option?

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    So I use a hidden field to store the first part of the pipe.

    I don’t think this may work as you describe.

    Thread Starter abelonger

    (@abelonger)

    I have been doing this for a number of years at this point without issue. Is there a different/better way I should be storing both values?

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    In the first place why do you need to store the both values?

    Thread Starter abelonger

    (@abelonger)

    Because of fields like this:

    [select* player-jersey-one id:player-jersey-one include_blank “Adult XS|37.50” “Adult SM|37.50” “Adult M|37.50” “Adult LG|37.50” “Adult XL|37.50” “Adult XXL|37.50” “N/A|0.00”]

    With the value of 37.50 used for multiple options and passed to my payment plugin, I don’t know what is actually being selected without also storing the first part.

    • This reply was modified 1 year, 4 months ago by abelonger.
Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Form field IDs no longer present’ is closed to new replies.