cakePHP display Form elements inline

cakephp, css, helper

Solution

By default, CakePHP puts `<div>`s around inputs. You can either add the `'div'=>false` option to each input:

echo $this->Form->input("username",array("label" => false, "div"=>false, "class" => false, "value" => "Username", "class" => "loginCredentials"));

Or, you can set the inputDefaults for the form itself:

echo $this->Form->create('whatever', array(
    'inputDefaults'=>array('div'=>'false', 'label'=>false)));

Problem

I am trying to display form elements inline built using the cakePHP Form helper. It appears it has to do with the classes it creates around the elements. I am sure this can be fixed with CSS but if there is another way i would rather do it right: ``` <?php echo $this->Form->create("users"); echo $this->Form->input("username",array("label" => false, "class" => false, "value" => "Username", "class" => "loginCredentials")); echo $this->Form->input("password",array("label" => false, "class" => false, "value" => "Password", "class" => "loginCredentials")); echo $this->Form->input("loginBtn",array("label" => false, "class" => false, "value" => "LOGIN", "class" => "loginCredentials", "type" => "submit")); echo $this->Form->end(); ?> ```

Original source