Custom Submit button

user198003 picture user198003 · Jul 5, 2010 · Viewed 37.9k times · Source

How can I create submit button, and define custom title on it, together with custom class style?

Answer

Mike picture Mike · Jul 5, 2010

You could use either submit() or button() methods of the Form helper instead of the end() method. For example:

echo $this->Form->submit(
    'Send', 
    array('class' => 'custom-class', 'title' => 'Custom Title')
);

Don't forget to close the form. You can do it by calling the end() method without any arguments.

echo $this->Form->end();