if i set it required into false, would that means the secondary field
can be empty?

how do i check something like this:

if (usesecondaryemail)
     validate secondary_email and secondary_email is not empty

can the validation for this specific fields be check from controller?


On Dec 16, 12:02 am, bingo <[email protected]> wrote:
> hi Markus,
>
> Within your secondary email validation criteria, set required:false
>
> $this->validate = array(
>      'primary_email' => 'email',
>      'secondary_email' => array(
>              'rule' => 'email',
>             'required' => false,
>            'message' => 'Please provide valid email address'
>     )
>
> )
>
> On Dec 15, 10:55 am, Markus <[email protected]> wrote:
>
> > hello,
>
> > currently I'm creating an user input form which in it have an optional
> > fields but that fields must be filtered too if the user give check on
> > a checkbox, here is the example of part pf the form:
>
> > use secondary email: <checkbox>
> > your secondary email: <input text>
>
> > what i want to do is disable the <input text> as default, when the
> > user give check on check box, the <input text> is activated and user
> > must fill the <input test> with a valid email address (couldn't be
> > empty).
>
> > right now, i can do filtering on the email address using CakePHP
> > filter, but how can i run the filter only when the user give check on
> > "use secondary email"
>
> > if the user doesn't give check on "use secondary email" then i don't
> > need to store the email value (it will be NULL in the database)
>
> > thank you
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to