Zend Framework Forum

Go Back   Zend Framework Forum > Zend Framework Components > Core Infrastructure

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-01-2009, 08:48 AM
Junior Member
 
Join Date: Jul 2009
Posts: 2
Default Form with a warning that a value should be corrected if wrong.

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 07-02-2009, 12:29 AM
Senior Member
 
Join Date: Jul 2008
Posts: 288
Default

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT. The time now is 01:07 AM.


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