Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-27-2008, 05:15 PM
Senior Member
 
Join Date: Jan 2008
Location: chicago
Posts: 101
Default Zend_Form: How do I add labels?

What is the simplest, most default way of adding labels to the input fields of a Zend_Form?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 03-28-2008, 01:44 PM
Junior Member
 
Join Date: Mar 2008
Posts: 12
Default

Quote:
Originally Posted by notrub225 View Post
What is the simplest, most default way of adding labels to the input fields of a Zend_Form?
Playing around with Zend_Form, I tend to subclass my forms and use the fluent interface:
Code:
$nameInput = new Zend_Form_Element_Text('name');
$nameInput->setLabel('name')
[...]
But I am very new to ZF, so I don't know, if this is the simplest, most default way to add labels.
Maybe there is no such 'most default way' ?
/friedhelm
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-28-2008, 09:56 PM
Junior Member
 
Join Date: Mar 2008
Posts: 15
Default

If you have your controller setup, you can call this directly in your view script

<?=$this->formLabel('xyz', 'ABC') ?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-07-2008, 10:46 AM
Junior Member
 
Join Date: Apr 2008
Posts: 1
Default

I did it like mentioned...
$inputfield->setLabel('whatever');

now the problem is that in the html i get this

<label class='ISdan IStxt required'...

I only set it to be IStxt.
The ISdan and required it got from the inputfield itself. why is that? i only need it to be class='IStxt' or it wont show right.

help please
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 12:32 PM.