PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Conditional Logic Breaks if Value is set to 0

  1. I have a form located at http://bus-site.kcdtest.com/get-an-alert/ (which is a dev/test site) The drop down you see is conditional logic if you select "Phone" or "Text" you'll see a phone field if you select "email" you see an "email" field. The problem is if you select "Text" then hit submit the default value for the dropdown (email) is selected.

    I have narrowed this down to the fact that the value of "text" is set to 0. If i set it to any other value it works fine. The problem is I need it set to '0' because the data is going into an external database.

    I'm assuming this is because somewhere you're using the php "empty" function and 0 shows up as empty so it moves on to the default value.

    One workaround may be for me to set the value to something until post submit then if the value is whatever set it to 0 before putting it into my external db. For example, set the value to 5 then if the value is 5 on gform_post_submission set it back to 0 before putting it into my DB.

    Any suggestions or additional work arounds would be great.

    Posted 13 years ago on Thursday April 14, 2011 | Permalink
  2. We'll take a look at this and recreate it on our end and see what needs to be changes so that it passes as 0 and not an empty value.

    Posted 13 years ago on Thursday April 14, 2011 | Permalink
  3. I am having trouble replicating your issue. I have created a form similar to yours and the 0 is being saved as 0 (not as blank). We did have this problem before, but we have corrected it.
    If you send me (alex@rocketgenius.com) a WP admin login to your test site, I will be glad to take a closer look.

    Posted 13 years ago on Thursday April 14, 2011 | Permalink
  4. I had misunderstood the issue. It is not how the data is stored, but how the drop down does not "hold" its value upon a form validation failure when the "0" item is selected.
    I have corrected the issue. Anyone experiencing this issue, please contact us to get a new version with the fix.

    Posted 13 years ago on Friday April 15, 2011 | Permalink
  5. This issue is now 100% resolved thanks to a patch from Alex. Thanks guys!

    Posted 13 years ago on Wednesday April 20, 2011 | Permalink
  6. The version that corrects this is available to anyone on the Downloads page. It will be released via automatic upgrade sometime next week most likely after we include other incremental updates in the final release.

    Posted 13 years ago on Wednesday April 20, 2011 | Permalink

This topic has been resolved and has been closed to new replies.