Ok I'm not too sure what type of details you need so I will provide
code snippets for you to look at:

multi-page form:
$val isset from a foreach loop from the following query:
$select = $fabrics->select()->setIntegrityCheck(false)
->from(array("f"=>"fabrics"), array("f.*"))
->joinLeft(array("fft"=>"fabrics_fabrictypes"), "f.id=fft.fabric_id",
array())
->joinLeft(array("ft"=>"fabrictypes"), "ft.id=fft.fabrictype_id",
array("ft.name as type"))
->joinLeft(array('fpt'=>'fabrics_producttypes'), 'f.id=fpt.fabric_id',
array('fpt.price'))
->where($where)
->order(array("ft.name desc", "f.name asc"));
$val->price is set to the value of 52

1st method
$text = new Zend_Form_Element_Text('pr_'.$val->id);
$text->setOptions(array('readOnly'=>true, 'label'=>'Price'));
$text->setValue($val->price);
$fabs->addElement($text, 'pr_'.$val->id);
the outputted form segment is:
2nd method
$fabs->addElement('text', 'pr_'.$val->id, array('label'=>'Price',
'readOnly'=>true, 'class'=>'transparent'));
$this->getElement('pr_'.$val->id)>setValue($val>price);

Price



I have tried different values for the name
using: $text->setOptions(array('value'=>$val->price));

I don't know what else to try.

Definitely not an issue with the variable not being set.:

$text = new Zend_Form_Element_Text('pr_'.$val->id);
$text->setOptions(array('readOnly'=>true, 'label'=>'Price'));
print("
val->price before:");
print_r($val->price);
print("
");
$text->setValue(number_format($val->price, 2));
print("
val->price after:");
print_r($val->price);
print("
");
$fabs->addElement($text, 'pr_'.$val->id);

I have attached a screen shot from my browser to show that the variables are
indeed set:
http://www.nabble.com/file/p22431571/Screenshot.png 
-- 
View this message in context: 
http://www.nabble.com/SetValue-not-setting-value-in-Zend_Form_Element_Text-tp22431571p22431571.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to