+ Reply to Thread
Results 1 to 2 of 2

Thread: Form with a warning that a value should be corrected if wrong.

  1. #1
    JoGi is offline Junior Member
    Join Date
    Jul 2009
    Posts
    3

    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

  2. #2
    Tekerson is offline 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

+ Reply to Thread

Similar Threads

  1. Zend Loader Warning
    By oO BlackCat Oo in forum Core Infrastructure
    Replies: 0
    Last Post: 05-20-2010, 01:26 PM
  2. Zend_Form_Element_File with Warning
    By stamas in forum Core Infrastructure
    Replies: 0
    Last Post: 10-07-2009, 12:33 PM
  3. Zend Date Performance Warning
    By leason in forum Internationalization (i18n) & Localization (l10n)
    Replies: 4
    Last Post: 08-28-2008, 06:24 PM
  4. MAMP PHP warning
    By eventhough in forum Installation & Configuration
    Replies: 0
    Last Post: 05-17-2008, 06:15 AM
  5. Warning: helper 'FormSubmit' not found....
    By evildave in forum Installation & Configuration
    Replies: 0
    Last Post: 04-28-2008, 05:02 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts