• Resolved tiagorodriguesweb

    (@tiagorodriguesweb)


    Is there a way to prevent the plugin sending information to the database when a condition is not necessary? For example I have some fields that only appear if the user selects “yes” on a select field. If he selects “no” those fields are not shown on the front-end but the info is still sent to the database when the form is submitted. It sends empty fields.

    I would like to prevent that because I’m showing empty fields on the wordpress dashboard for other connected users (I’m using Contact Form CFDB7 plugin to show the submitted form infos on wordpress dashboard, I’m not sending an email with the form informations).

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jules Colle

    (@jules-colle)

    There’s no solution that I’m aware of currently. Conditional fields submits all fields (including the hidden ones).

    Depending on your use case, you can work around this by designing your forms with multiple fields sharing the same name and using disable_on_hide on your groups. This way, only the visible fields would be submitted by your form. https://conditional-fields-cf7.bdwm.be/disable_on_hide/

    Thread Starter tiagorodriguesweb

    (@tiagorodriguesweb)

    Thanks for your response.

    I’m working with inputs type text and selects on my form. I have some required inputs and selects that appear if the user clicks “yes” on a select. If user clicks “no” those required fields are not shown and are sent empty which is fine.

    For inputs, if they are empty it’s value is ” ” but for selects with first_as_label option I don’t know what value is sent. Do you know how to find it?

    Plugin Author Jules Colle

    (@jules-colle)

    When you are using first_as_label, and you have the first option selected, than the submitted value will be an empty string ""

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Prevent plugin sending info to the database when condition is not necessary’ is closed to new replies.