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


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-08-2008, 12:42 PM
Junior Member
 
Join Date: Aug 2008
Posts: 3
Default zend_form

Hi,

I am trying (with very little success) to generate a form that a user clicks on, then this is sent and a lookup done in a database. The result is then passed back to a form to allow the user to alter the data returned from the database.

How do I prepopulate a field in zend_frames?

I have :

$lastName = new Zend_Form_Element_Text('Student_LastName');
$lastName ->setLabel('Last Name')
->setRequired(true)
->addValidator('NotEmpty')
->setDecorators(array
(
'ViewHelper',
'Errors',
array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')),
array('Label', array('tag' => 'td')),
array(array('row' => 'HtmlTag'), array('tag' => 'tr')),
));

I want to set the default value as $row.['lastname']. What is the best way to do this?

I would think it would be with a decorator but after searching for an hour am going around in circles and think I may have just gradually made this very complicated in my head )
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 08-08-2008, 02:29 PM
Junior Member
 
Join Date: Aug 2008
Posts: 3
Default

Sorry, This should read how do I populate a default value into a form element.

No tzend_frames. Less coffee I think
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 08-08-2008, 04:34 PM
Junior Member
 
Join Date: Aug 2008
Posts: 3
Default

Yep - made it to complicated.

Its:

$form1->setDefaults(array());

I initially tried this but mis-read the doc's and thought you applied the setDefaults to the element but you set it on the form. All working now
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:23 PM.