Another option is 2 forms.
When you get the users info do an 'if' in the controller on the sex and
display the correct form
If ($this->data['Profile']['sex'] == female )
{
$this->render('edit_female_form')
} else {
$this->render('edit_male_form')
}
Or in the form do it with the set data
If ($user['Profile']['sex'] == female )
{
echo $form->input('hips');
}
Possibly?
Dave
-----Original Message-----
From: appel268576 [mailto:[email protected]]
Sent: November-10-09 3:50 PM
To: CakePHP
Subject: Re: Running Conditional If statements in the form
let me explain bit more.
A customer signs up and has a profile.
Only certain info are posted into their profile with initial sign up such as
sex country etc.
When they then EDIT their profile there are more options, from which the
field should show, only if the user is a female.
hope this is clearer
On Nov 10, 4:14 pm, "Dave" <[email protected]> wrote:
> Javascript? If the user selects an option trigger an event to have the
> field appear or be removed?
>
> -----Original Message-----
> From: appel268576 [mailto:[email protected]]
> Sent: November-10-09 10:15 AM
> To: CakePHP
> Subject: Running Conditional If statements in the form
>
> Hi cake community.
>
> I have come across a little problem whilst developing my app.
>
> I am sure that someone has come across this before and hopefully a
> quick fix.
>
> I have an option where if people are editing their profile based on
> their SEX they should be able to fill in certain info.
>
> please help.
>
> here is what I got
>
> if ($form->radio('sex', array('value')) == 'Female'){
> echo $form->input('hips');
> }
>
> so basically if the sex of the person = Female, then I want to display
> an input which allows them to enter info about their hip measurement
> into the input
>
> --
>
> 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
athttp://groups.google.com/group/cake-php?hl=.
--
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=.
--
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=.