hellojohn
hellojohn

Reputation: 109

how to add form id in cakephp when creating a form

i am new in cakephp so i dont know how can i do this ..

i want to add custom form id in my form but it is not adding the id ..it is using the default one adding the 'UserIndexForm' id.. how can i add this id i want to do like this

<form method="post" action="#" id="form-login">      

here cakephp code

<?php
echo $this->Form->create('User', array(
'inputDefaults' => array(
    'label' => false,
    'div' => false,
    'id' =>'form-login'//not working

)
  ));

?>

please help me if anyone know this thankyou in advance

Upvotes: 0

Views: 4180

Answers (1)

user1767586
user1767586

Reputation: 458

The inputDefaults option is only changing the input fields so you need to set the id on the root level of the array:

<?php
echo $this->Form->create('User', array(
'id' => 'form-login',
'inputDefaults' => array(
    'label' => false,
    'div' => false

)
  ));

?>

Upvotes: 2

Related Questions