Why are you even bothering with a using a text input? Set the value
you want to be sent to the server in a *hidden* field. If you also
need something to display it to the user, user an h6 element (or
whatever). There's no need to make this a text field.

On Fri, Jan 23, 2009 at 9:45 AM, Pyrite <thelette...@gmail.com> wrote:
>
> FIXED!!
>
> You can set the readonly property on a form text input
> ('readonly'=>'readonly') which will behave the same way as disabled,
> in that the end-user can't change the value of it (yet you can like I
> do via a script), and still gets submitted in the form into $this-
>>data.
>
> Appreciate all the help!
>
> On Jan 23, 8:35 am, Pyrite <thelette...@gmail.com> wrote:
>> Hmmm, are you sure? I remember doing it in the past , 5-6 years ago
>> with PHP4, not sure how I did it then. I disabled it via Javascript
>> though, not xhtml. Wonder if that will make a difference.
>>
>> On Jan 23, 8:27 am, Dardo Sordi Bogado <dardoso...@gmail.com> wrote:
>>
>>
>>
>> > > However I guess Cake strips it out on submission.
>>
>> > The browser will not submit disabled inputs.
>>
>> > > On Jan 22, 7:08 pm, Yusuf Widiyatmono <wmo...@yahoo.com> wrote:
>> > >> 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.
>>
>> > >> Fromhttp://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?- Hide quoted text -
>>
>> > >> - Show quoted text -- Hide quoted text -
>>
>> > - Show quoted text -- Hide quoted text -
>>
>> - Show quoted text -
> >
>

--~--~---------~--~----~------------~-------~--~----~
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