Nathan,

There was a nice article explaining in the bakery a few years back that 
would solve your problem:

http://bakery.cakephp.org/articles/RabidFire/2010/06/26/multiple-forms-per-page-for-the-same-model

On Friday, April 5, 2013 6:31:26 AM UTC-7, Nathan Pierce wrote:
>
> Anyone have a solution for this yet? 
>
> Again, I have one pay with a login and registration form. I want the 
> validation messages from the User model to not show on both email inputs on 
> that page, I want them assigned to only one. This may require changing the 
> login form input to email_login, but then it won't connect properly and log 
> me in. Can someone clarify the best method of doing this?
>
> On Wednesday, April 3, 2013 7:25:51 PM UTC-4, Nathan Pierce wrote:
>>
>> Hey all! I have to say this community is awesome. I'm pleased to see 
>> there is help for newbies like me.
>>
>> I have an issue which I need suggestions for. I like doing things the 
>> proper way and not creating an obtuse mess of code to do something simple. 
>> Here it is:
>>
>> Uses Auth (nothing crazy)
>>
>> View - register.ctp contains a registration form: 
>>
>> <?php
>> echo $this->Form->create('User', array('action' => 'register'));
>> echo $this->Form->input('full_name', array('label' => 'Full Name'));
>> echo $this->Form->input('email_register', array('label' => 'Email'));
>> echo $this->Form->input('password', array('type' => 'password', 'label' 
>> => 'Password'));
>> echo $this->Form->input('password_confirm', array('type' => 'password', 
>> 'label' => 'Confirm Password'));
>> echo $this->Form->hidden('role', array('value' => 'student'));
>> echo $this->Form->end('Register');
>> ?>
>>
>> Then, the layout it uses (login.ctp) calls another form:
>>
>> <?php
>> echo $this->Form->create('User', array('action' => 'login'));
>> echo $this->Form->input('email', array('label' => false, 'type' => 
>> 'email_login', 'value' => '', 'placeholder' => 'Email'));
>> echo $this->Form->input('password', array('label' => false, 'type' => 
>> 'password_login', 'value' => '', 'placeholder' => 'Password'));
>> echo $this->Form->submit('GO', array('class' => 'login_submit'));
>> echo $this->Form->end();
>> ?>
>>
>> My problem is that when register.ctp passes the data to the User.php 
>> model, and does the validation, the login.ctp form gets the 'message =>' 
>> from the model as well as the register.ctp form.
>>
>> Now, I need both the register.ctp and login.ctp form to check the 
>> database if the email exists, run the validation if it's valid, etc etc. I 
>> think you get the idea. My first idea was to change the login.ctp form from 
>> input('email' to input('email_login' and have it act the same as the normal 
>> email, just ignore the validation message. I looked and looked and couldn't 
>> find any examples of how to achieve this. 
>>
>> Any suggestions?
>>
>> Thanks!
>>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to