[symfony-users] Re: isValid always showing false
I want to validate my object cause these will not be given in by a form but by URL (cause the frontend requires this) so actualy i want a modelvalidation but i don't think this is possible so i tried putting my object in the form and then validate the form. but it always returns false and i looked at it if the form is shown it actualy shows the input is written in it but still the valid doesn't return true (and al validation rules are ok) On 20 apr, 08:07, Gareth McCumskey gmccums...@gmail.com wrote: The isValid() method is a validation check on user input after a user has submitted a form based on the validators you create in the forms object. Its not used to see if the form structure itself is valid. On Mon, Apr 19, 2010 at 4:37 PM, kim thechosendra...@gmail.com wrote: hello, To see if a object is correct i put it in a form (but never show it) then i try the isValid() function but this always shows false i tried to check global errors, errors but all arrays are empty this is my code: $form = new paperForm($paper); $form-disableCSRFProtection(); if($form-isValid()){ echo 'correct'; }else{ echo 'incorrect'; } PaperForm.Class public function configure() { $this-validatorSchema['email'] = new sfValidatorAnd(array($this- validatorSchema['email'], new sfValidatorEmail())); } it always shows incorrect. and when i echo $form-isValid(); it just shows nothing thanks Greetings -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -- Gareth McCumskeyhttp://garethmccumskey.blogspot.com twitter: @garethmcc -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/symfony-users?hl=en- Tekst uit oorspronkelijk bericht niet weergeven - - Tekst uit oorspronkelijk bericht weergeven - -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en
Re: [symfony-users] Re: isValid always showing false
You need to bind posted values to the form object for isValid() to run the validation checks. Assuming form_values is a form array where each field in the form is named as name=form_values[fieldname] then this is how: $form_object = new FormObject(); $form_object-bind($request-getParameter('form_values')); if ($form_object-isValid()) { //Code that runs if the submitted values are valid according to FormObject's validators } That bind() is critical. On Tue, Apr 20, 2010 at 12:34 PM, kim thechosendra...@gmail.com wrote: I want to validate my object cause these will not be given in by a form but by URL (cause the frontend requires this) so actualy i want a modelvalidation but i don't think this is possible so i tried putting my object in the form and then validate the form. but it always returns false and i looked at it if the form is shown it actualy shows the input is written in it but still the valid doesn't return true (and al validation rules are ok) On 20 apr, 08:07, Gareth McCumskey gmccums...@gmail.com wrote: The isValid() method is a validation check on user input after a user has submitted a form based on the validators you create in the forms object. Its not used to see if the form structure itself is valid. On Mon, Apr 19, 2010 at 4:37 PM, kim thechosendra...@gmail.com wrote: hello, To see if a object is correct i put it in a form (but never show it) then i try the isValid() function but this always shows false i tried to check global errors, errors but all arrays are empty this is my code: $form = new paperForm($paper); $form-disableCSRFProtection(); if($form-isValid()){ echo 'correct'; }else{ echo 'incorrect'; } PaperForm.Class public function configure() { $this-validatorSchema['email'] = new sfValidatorAnd(array($this- validatorSchema['email'], new sfValidatorEmail())); } it always shows incorrect. and when i echo $form-isValid(); it just shows nothing thanks Greetings -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -- Gareth McCumskeyhttp://garethmccumskey.blogspot.com twitter: @garethmcc -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/symfony-users?hl=en- Tekst uit oorspronkelijk bericht niet weergeven - - Tekst uit oorspronkelijk bericht weergeven - -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -- Gareth McCumskey http://garethmccumskey.blogspot.com twitter: @garethmcc -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en
[symfony-users] Re: isValid always showing false
If you want to validate your existing objects, you can bind the form with the defaults. On Apr 20, 12:34 pm, kim thechosendra...@gmail.com wrote: I want to validate my object cause these will not be given in by a form but by URL (cause the frontend requires this) so actualy i want a modelvalidation but i don't think this is possible so i tried putting my object in the form and then validate the form. but it always returns false and i looked at it if the form is shown it actualy shows the input is written in it but still the valid doesn't return true (and al validation rules are ok) On 20 apr, 08:07, Gareth McCumskey gmccums...@gmail.com wrote: The isValid() method is a validation check on user input after a user has submitted a form based on the validators you create in the forms object. Its not used to see if the form structure itself is valid. On Mon, Apr 19, 2010 at 4:37 PM, kim thechosendra...@gmail.com wrote: hello, To see if a object is correct i put it in a form (but never show it) then i try the isValid() function but this always shows false i tried to check global errors, errors but all arrays are empty this is my code: $form = new paperForm($paper); $form-disableCSRFProtection(); if($form-isValid()){ echo 'correct'; }else{ echo 'incorrect'; } PaperForm.Class public function configure() { $this-validatorSchema['email'] = new sfValidatorAnd(array($this- validatorSchema['email'], new sfValidatorEmail())); } it always shows incorrect. and when i echo $form-isValid(); it just shows nothing thanks Greetings -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -- Gareth McCumskeyhttp://garethmccumskey.blogspot.com twitter: @garethmcc -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/symfony-users?hl=en-Tekst uit oorspronkelijk bericht niet weergeven - - Tekst uit oorspronkelijk bericht weergeven - -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/symfony-users?hl=en -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en
[symfony-users] Re: isValid always showing false
Form validates only during sfForm::bind and only values given to sfForm::bind, ie try $form = new paperForm(); $form-bind( array( 'paper' = $paper )); if ( $form-isValid() ){ } But are you sure to use form for purposes? sfForm is designed for user input, not for another things On Apr 19, 5:37 pm, kim thechosendra...@gmail.com wrote: hello, To see if a object is correct i put it in a form (but never show it) then i try the isValid() function but this always shows false i tried to check global errors, errors but all arrays are empty this is my code: $form = new paperForm($paper); $form-disableCSRFProtection(); if($form-isValid()){ echo 'correct'; }else{ echo 'incorrect'; } PaperForm.Class public function configure() { $this-validatorSchema['email'] = new sfValidatorAnd(array($this-validatorSchema['email'], new sfValidatorEmail())); } it always shows incorrect. and when i echo $form-isValid(); it just shows nothing thanks Greetings -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/symfony-users?hl=en -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en