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.

Required condition not working for Drop down boxes

  1. See my form at http://www.renttoownhotlist.com/aweber/
    Don't select anything and hit next. GF doesn't catch that
    the user never selected anything! All drop down boxes
    on this form act the same way. Tell me why please?

    Thanks.

    Posted 12 years ago on Saturday May 19, 2012 | Permalink
  2. Technically, the "Select One" is an option. You'd want to use our gform field validation filter:

    http://www.gravityhelp.com/documentation/page/Gform_field_validation

    Posted 12 years ago on Sunday May 20, 2012 | Permalink
  3. Rob,
    How do you get to the source code a particluar form to add the PHP code?

    Posted 12 years ago on Monday May 21, 2012 | Permalink
  4. David Peralty

    You'll be putting it in your theme's functions.php file:
    http://www.gravityhelp.com/documentation/page/Where_Do_I_Put_This_Code%3F

    Posted 12 years ago on Monday May 21, 2012 | Permalink
  5. Actually, you can try this out and see if it works as a work around: http://www.gravityhelp.com/forums/topic/drop-down-list-default-value-and-error-checking#post-48891

    Posted 12 years ago on Monday May 21, 2012 | Permalink
  6. I found this thread searching for "Field Validation". I am able to get the code to work in general but I want it to only validate if the field is not empty. The number 0 would be allowed but not an empty field. I'm not sure how I would write the if statement? I tried using is_int() to see if it was an integer but I think a non empty value is being read as the number zero. Is that right?

    if($result["is_valid"] && intval($value) < 10)
    Posted 12 years ago on Friday May 25, 2012 | Permalink
  7. Hi Gary,

    Could you provide a little more information on your setup? I tested with a drop down field and setting it to required will prevent empty values from passing but will pass validation for "0". What field type are you using?

    Posted 12 years ago on Friday May 25, 2012 | Permalink
  8. Sorry I guess I should've given more details. The field is a Single Product field.

    Posted 12 years ago on Friday May 25, 2012 | Permalink
  9. There are three different sets of inputs A, B and C. When a user chooses A from a dropdown its lets them fill in the inputs for Product A. But we've noticed are not filling in the quantity inputs and submitting the form. So I would like it to validate only if the input is not empty.

    Posted 12 years ago on Friday May 25, 2012 | Permalink
  10. Hi Gary,

    Just sent you an email with an updated version of Gravity Forms which will allow you to submit 0 as a valid value for required single product fields.

    Posted 12 years ago on Friday May 25, 2012 | Permalink
  11. David

    Thank you for helping us with this problem. I installed the new version and now when I make those fields required it allows an empty field to be submitted.

    Posted 12 years ago on Friday May 25, 2012 | Permalink

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