• Resolved atelierdevs

    (@atelierdevs)


    The recent addition of enum validation in version 5.9 has broken a couple of fields (dropdown and checkboxes) that are added dynamically through javascript. I’m getting the validation error ‘Undefined value was submitted through this field’.

    I’ve reverted to a previous version for now, but how do I disable enum validation for the plugin/specific fields?

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

    (@takayukister)

    The enum validation is added using the wpcf7_swv_create_schema action hook (see checkbox.php and select.php), so you can remove_action() them to deactivate the validation. Reassign your own action function if necessary.

    Thread Starter atelierdevs

    (@atelierdevs)

    That worked! Thank you

    What exactly needs to be done? I’m not technical and I have the same error… please help me, what exactly should I change so that I don’t have this error?

    sonnesworld

    (@nachhaltigejobs)

    Same here, please update in next plugin version. Many thanks.

    Pretty unhelpful and ambiguous reply from the dev there.

    I am dynamically populating a select field with values, and this change has broken all selects populated this way. Extremely inconvenient. The fix for me was to remove the action in functions.php, just before the code that populates the select field:

    remove_action(
    ‘wpcf7_swv_create_schema’,
    ‘wpcf7_swv_add_select_enum_rules’,
    20, 2
    );

    The easiest option for now is probably removing the enum validation for dropdowns like:

    remove_action( 'wpcf7_swv_create_schema', 'wpcf7_swv_add_select_enum_rules', 20, 2 );

    A more refined approach would involve creating a similar validation rule that incorporates appropriate values. This might be relevant if you’re configuring dropdown values based on custom posts, ACF fields, or any other sources.

    hi, two questions and will appreciate any help thanks

    1. the new action hook added would it still stay in the next updates? if yes would it be fix from issues flagged down above?
    2. using the temporary fix suggested above, can we use it as permanent fix or this will affect something in the future.

    Thanks

    mhmuc

    (@mhmuc)

    I have the same problem that @pwsean described with the dynamically populated select fields.

    However putting the remove_action code in my functions.php did not solve the issue. Any other idea?

    Thank you!

    frensis

    (@frensis)

    remove_action( 'wpcf7_swv_create_schema', 'wpcf7_swv_add_select_enum_rules', 20, 2 );

    This code in functions.php works for me.
    Is it possible to be more specific and deactivate validation only for certain form (eg. by form id)?

    mhmuc

    (@mhmuc)

    I got it to work with the remove_function in the functions.php last night.

    I wanted to deactivate it in the module, that is populating the form which didn’t work. I guess it was a problem with priorities or when the function was called. I had no time for further troubleshooting. Thank you for you help.

    suvi15

    (@suvi15)

    ***UPDATE***
    I put this code in the wp-content/themes/”your-theme-name”/functions.php
    and it works!

    *************
    Where should I paste this code in fuctions.php? Anywhere?
    remove_action( ‘wpcf7_swv_create_schema’, ‘wpcf7_swv_add_select_enum_rules’, 20, 2 );

    I just put it in the bottom and it doesn’t work.

    • This reply was modified 8 months ago by suvi15.
    • This reply was modified 8 months ago by suvi15.
    brookjacoby

    (@brookjacoby)

    Not working for me…

    Put the code in functions.php.

    llcelinell

    (@llcelinell)

    Hello, the code inserted in functiun.php works on the computer version of the form but not on the mobile version (cell phone) the error message is still present in all my check boxes (from the 5th box).. . What to do ? Do you plan to update the plugin soon?

    suvi15

    (@suvi15)

    Same here, lik (@llcelinell). Not working in Mac or iOS.

    Unfortunately this was not resolved for me. I have added the remove_action in my child theme functions file and nothing.

    If I edit the plugin file select.php),?and remove the add_action, then the form works.

    The function remove_action does not work.

Viewing 15 replies - 1 through 15 (of 23 total)
  • You must be logged in to reply to this topic.