In addition it's worth mentioning that the only reason I was trying to apply custom validation is because the dropdown field I marked as "required" in the GF admin area was not being picked up as invalid during form submission.
The process was:
1) Form is rendered and dropdown A is populated with values form a Custom Post Type.
2) When the user selects from dropdown A, some javascript runs which populates dropdown B with the correct values (these are from another post type).
3) When the form is submitted with the default value (eg: "Please select") Gravity forms allows the form to be submitted even though it should fail validation due to no value being selected.
I've now resolved the issue which lies in the GF's admin interface for Form creation. The issue was that by default even though I'd removed all but 1 value for the dropdown B, GF's was setting a "value" attribute on the option element. This caused it to pass validation as there was always value selected.
To solve this, in the form builder admin area you must select "Show values" on the "Choices" field and then ensure that the contents of the "Value" field is entirely blank. I feel this should be made more obvious.
So in essence my issue is solved in the short term. Nonetheless I would appreciate feedback from your developers on how I might be able to add_filter using a Class method.
Posted 11 years ago on Thursday January 17, 2013 |
Permalink