$last_name->setValue('testsamy'); no set the value if the form after
submitting, $last_name = $_POST['last_name'] ($_POST['last_name'] no exist
because last_name is disable) and no testsamy. I want to force this value
because element is disable and when there are errors on the form the element
last_name has a null value.
vince. wrote:
>
> Hi,
>
> I did not understand where you place the null value in the code above, But
> if you do this:
>
> $last_name->setAttrib('disable', null);
>
> this will unset the 'disable' element from the form. It doesn't accept
> null
> values.
>
> On Fri, May 29, 2009 at 1:07 AM, samuel verdier
> <[email protected]>wrote:
>
>>
>> hello,
>>
>> I want to set a value to an element after submitting the form.
>> I need it because one element is disable and when there are errors on the
>> form the element has a null value.
>>
>> this code doesn't works, value = null :
>>
>> class App_Form extends Zend_Form
>> {
>> public function init()
>> {
>> $last_name = $this->createElement('text', 'last_name')
>> $last_name->setAttrib('disable', true);
>> $last_name->setValue('testsamy');
>>
>> .............
>>
>> return $this;
>> }
>> }
>>
>> this code works, value = test:
>>
>> class App_Form extends Zend_Form
>> {
>> public function init()
>> {
>> $last_name = $this->createElement('text', 'last_name')
>> $last_name->setAttrib('disable', true);
>> $last_name->setValue('testsamy');
>>
>> .............
>>
>> return $this;
>> }
>>
>> public function isValid($data)
>> {
>> $valid = parent::isValid($data);
>>
>> $this->getElement('last_name')->setValue('test');
>>
>> return $valid;
>> }
>> }
>>
>> How can i do without overloading the method isValid ?
>>
>> Thanks
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Zend_Form-setValue-tp23770977p23770977.html
>> Sent from the Zend Framework mailing list archive at Nabble.com.
>>
>>
>
>
> --
> Vincent Gabriel.
> Lead Developer, Senior Support.
> Zend Certified Engineer.
> Zend Framework Certified Engineer.
> -- http://www.vadimg.co.il/
>
>
--
View this message in context:
http://www.nabble.com/Zend_Form-setValue-tp23770977p23776593.html
Sent from the Zend Framework mailing list archive at Nabble.com.