Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.3.2

Request #19598 Validate Single Field
Submitted: 2012-09-07 21:10 UTC
From: gebert Assigned:
Status: Analyzed Package: HTML_QuickForm2 (version 2.0.0)
PHP Version: 5.3.12 OS: Ubuntu/Lucid
Roadmaps: (Not assigned)    
Subscription  


 [2012-09-07 21:10 UTC] gebert (Gene Ritter)
Description: ------------ There appears to be no way to validate a single field. Validate() is protected and the rules array is protected on the Node class. We would like to make server remote calls for validation of a single field in a form object. It appears there is no way to do this without extending the QuickForm2 object. Please create a standard interface to do this.

Comments

 [2013-01-29 02:57 UTC] avb (Alexey Borzov)
-Status: Open +Status: Analyzed
I am not sure that validate() on a single field will work as intended unless very special precautions are taken. validate() works with element value, so that should be set properly. Also element's rules may be chained, so values of all elements in a chain should be set properly. You may end up submitting the values of the whole form instead of just one value. What exactly is the use case here? Validation of form fields via AJAX?
 [2013-01-29 03:06 UTC] gebert (Gene Ritter)
We were making an ajax call to vaildate a single field on focus out. We didn't want to recreate the logic for a single field. Submitting the entire form wasn't an option. So we looked at ways to do this and found that the methods that might be called were marked protected. We were hoping there might be a way to reuse the validation for a single field.