I have recently been assigned a CSS & design project that’s in a CakePHP environment and would like to know if I can add an additional button to the form, for a “sign up” link.
The form is currently:
echo $form->create('User', array('action' => 'login'));
echo $form->inputs(array(
'legend' => 'Please log in:',
'username', 'password'));
echo $form->end('Login');
I would like to inject a button that goes to an action of ‘register’, preferably after the “Login” button, on the same line, like this:
username: [ ]
password: [ ]
[Log In] [Register]
I have everything but the ‘register’ button. Is this possible using the ‘automagic’ form creation? Thank you.
Yep, pretty easy in Cake! Just use the FormHelper’s “button” method.
of course, this will still send the action to the URL specified in Form::create, but you can do some magic in the controllers to correctly act on the request.
http://book.cakephp.org/view/791/button