0
votes

I'm using this code now
echo $form->input('username');

How do I make sure the label shows up on a different line than the input field?

I managed to imitate what I'm trying to do, just want to make sure that I'm using it the right way.
echo $form->label('username', 'Username');
echo $form->input('username', array('label' => false));

Thanks,
Tee

2

2 Answers

2
votes

The core of your request is putting a line-break between the <label> and <input> tags created by the FormHelper::input method. You can accomplish this in several ways. Probably the simplest option is the following:

echo $form->input('User.username', array('between'=>'<br />'));

Or you could also use a pure CSS solution, something like:

<style type="text/css">
    div.input label { display: block; }
</style>
<?php echo $form->input('User.username'); ?>

This second option would leave you with cleaner PHP in your views, at the cost of more potential layout/stylesheet headaches.

-1
votes

Try this out.

<p>Username</p>    
<?php echo $form->input('username', array('div' => false, 'label' => false)) ?>