php - zend form validation -


I wonder how Zend_Form validates the input, I mean how it knows which input fields are valid Looked at php globals ($ _ POST, $ _GET) and I came to know how to authenticate (for example) not set to show if someone can give me any suggestions for this stuff ?

Good, it is the best option to find:

  / ** * Validate the form * * @The ultimate array $ data * @ Return boolean * / Public function is valid ($ data) {if (! Is_are ($ data)) {Require_once 'Zend / Form / Exception.php '; Throw new Zend_Form_Exception (__ METHOD__. 'An array is expected'); } $ Translator = $ this- & gt; Gettranslator (); $ Valid = true; $ Ebelongto = null; If ($ this-> isArray ()) {$ eBelongTo = $ this- & gt; GetElementsBelongTo (); $ Data = $ this- & gt; _dissolveArrayValue ($ data, $ eBelongTo); } $ Context = $ data; Forex currency ($ this-> getElements () $ key = & gt; $ element) {if (zero! == $ translator & amp; $ this-> translator () & amp; amp; Amp; amp;! Element element-> HasTranslator ()) {$ element-> Set translator ($ translator); } $ Check = $ data; If (($ $ affiliate = $ element-> getBelongsTo ())! == $ eBelongTo) {$ check = $ this-> _dissolveArrayValue ($ data, $ associTo); } If (! Asset (check $ $ [$ of]) {$ Valid = $ element-> Allyd (blank, $ reference) & amp; Amp; $ Valid; } And {$ valid = $ element-> Is Valid ($ [Check $], $ Reference) & amp; Amp; $ Valid; $ Data = $ this- & gt; _dissolveArrayUnsetKey ($ data, $ affiliation, $ key); }} Foreach ($ this-> getSubForms () = $ form = $ form} {If (zero! == $ translator & amp; !! $ Form-> Transtrator ()) { $ Form- & gt; SetTranslator ($ translator); } If (isset ($ data [$ key]) & amp; amp;; $ form-> isArray ()) {$ Valid = $ form-> Allyd ($ data [$ key]) & amp; Amp; $ Valid; } And {$ valid = $ form-> Allyd ($ data) & amp; Amp; $ Valid; }} $ This-> _errorsExist =! $ Valid; // If manually manually flagged as an error, then return the invalid status ($ -> - Laura Force); Return the return; } Return $ Valid; }   

Which means in a nutshell, the form will be repeated on all configured elements in the Zend_Form form and compare them with those values ​​in the array you provided. If there is a match, then it will validate that individual value against configured assumptions.

Comments