![]() |
|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
Hi,
I'm trying to solve a warning message on my custom validator. This message should only be visible to the user once if the field don't validate. The next submit will result in that the form is submitted without errors and accepts the value. A "notice" message that the value entered is not in the range and should be corrected if its not correct. If correct we will accept in in the next submit of the form. How is this best solved? the field looks like this now: [PHP] $validateSalary = new Default_Plugin_ValidatorSalary(); $salary = new Zend_Form_Element_Text('salary'); $salary->setLabel('Lön') ->setRequired(true) ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => 'Måste fyllas i'))) ->addValidator($validateSalary, false); [/PHP] ~JoGi |
|
|||
|
So you're basically implementing an "Are you sure?" type system via the validator?
The only way I can think of would be to have the validator store the value in the session, a cookie or a hidden field the first time, then only accept it the second time if it doesn't change. If you could populate the hidden field the first time, it would make the second time act like a "confirm" field (often used for passwords) where both field must match.
__________________
Brenton Alker PHP Developer - Brisbane, Australia blog.tekerson.com | twitter.com/tekerson | brenton.mp |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
| Designed by: Miner Skinz |
Powered by vBulletin® Version 3.8.4 Copyright ©2000 - 2010, Jelsoft Enterprises Ltd. Search Engine Friendly URLs by vBSEO 3.1.0 |
![]() |