Ben Aidley
Ben Aidley

Reputation: 347

CakePHP 1.2 custom label for form helper input

I am editing views/elements/form_user.ctp and require a custom label for my input, I cannot change the current value from city to say city/town because this value must correspond to the database field.

My code is currently:

 echo $form->input('city'); 

How do I add a custom label to the form helper to display a customised label that doesn't output text as exactly the name of the database field?

Upvotes: 0

Views: 861

Answers (2)

Dunhamzzz
Dunhamzzz

Reputation: 14808

I suggest you read the docs as this is pretty basic stuff imho!

echo $form->input('city', array('label' => 'My Field')); 

Upvotes: 1

jeremyharris
jeremyharris

Reputation: 7882

echo $form->input('city', array(
  'label' => 'My Label'
)); 

It's in the docs...

Upvotes: 1

Related Questions