If the value of disabled form element could changed dynamically (maybe you have 
some lil process on your view), maybe you need some little javascript script 
here...

<script>
function test(){
    document.ItemEdit.getElementById('ItemQuantytyHid').value = 
document.ItemEdit.getElementById('ItemQuantyty').value;
}
</script>

print $form->create('Item', 
array("action"=>"edit","onsubmit"=>"javascript:test();"));
print $form->input('Item.quantity', array("label"=>"Quantity", 
"disabled"=>"disabled");
print $form->hidden('Item.quantityHid');
print $form->end('Submit');

 
and then in your controller
you have to do this

if(!empty($this->data)){
    $this->data['Item']['quantyty] = $this->data['Item']['quantytyHid];
    $this->Item->save($this->data['Item']);
}

i have not tested this yet :P, but i think you could figure it out :)...

hope this help..




________________________________
From: Dardo Sordi Bogado <dardoso...@gmail.com>
To: cake-php@googlegroups.com
Sent: Friday, January 23, 2009 9:39:28 AM
Subject: Re: How to submit form elements that are disabled?


> I want to have a form text input get submitted, but also want it to be
> disabled on display.

>From http://www.w3.org/TR/html401/interact/forms.html#h-17.12 :

...the INPUT element is disabled. Therefore, it cannot receive user
input nor will its value be submitted with the form.

you also need to add the field as hidden, so it's value will be posted.


> Eg. $form->input('frmInputQuantity', array('label'=>'Quantity:',
> 'disabled'=>'disabled'));
>
> This does not get submitted into $this->data. How can I change what
> gets posted to $this->data with the form helper?
>
>
> >
>



      
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to