• My form needs 4 select with Brazilian states and cities. The number of cities is 5565. And each set of cities appears according to the previous selection of the state in the related select. Therefore, it is completely unfeasible to do this via the plugin’s backend. Therefore, I created a Javascript to dynamically populate these selects from json, using the “action hook” field. My problem is that when submitting the form, the fluent form validation does not accept the dynamic field. Is there any way to validate this? I currently use this solution with Contact Form 7 but it creates other problems for me, and the Fluent Form form management is much better.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Amimul Ihsan Mahdi

    (@amimulihsanmahdi)

    Hello @fan297,

    As your fields requires previous selection states, you can use the chained select field; here is the documentation that you can try.

    In addition, can you please mention what error you are getting upon submitting the form? if possible please share some screenshots or details of the issue, we’ll investigate and get back to you.

    Thank you

    Thread Starter Fabio Nogueira

    (@fan297)

    I saw the documentation you gave me, and apparently this will solve my problem in another way… but if there is any way to validate with the solution I created in java script with the options being generated dynamically, it would be good to not have all the work that redoes the process in another way. – The error displayed is the following: “The given data was invalid” screenshot

    Plugin Support Amimul Ihsan Mahdi

    (@amimulihsanmahdi)

    Hello there,

    Since version 5.0+ Fluent Forms improves the validation process hence if you add any data using custom code, you need to add the the below code to add the validation:

    add_filter('fluentform/validate_input_item_select', function ($error,$field) {

    if($field['name'] == 'name_attribute'){
    return [];
    }

    }, 10, 2);

    Change name_attribute with your dropdown field’s name attribute and this will resolve the issue.

    Thank you

    Thread Starter Fabio Nogueira

    (@fan297)

    This resolved it perfectly. Thanks.

    Hi there, i would like to know; how to implement this using dinamyc and CPT elements with same scenario like Brazilian states and cities?

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