PDA

View Full Version : submitValue of disabled textfield



mjhaston
21 Feb 2013, 12:46 PM
Anyone having trouble with this on 4.1.1? The value is NOT submit with the form. I have this and the state field disabled. A call to the USPS populates these fields after the zipcode is entered. I can see that the field are populated, but upon submission of the form those fields are not in the POST.




xtype : 'textfield',
fieldLabel : 'City/Town',
submitValue : true,
name : 'mailingCity',
id : 'mailingCity',
flex : 1,
allowBlank : true,
disabled : true

scottmartin
21 Feb 2013, 1:12 PM
Disabled fields are not submitted ... have a look at the following:
http://jsfiddle.net/gk6nF/

Scott.

mjhaston
21 Feb 2013, 1:19 PM
Okay, I guess I read the docs wrong. I thought submitValue would override the disabled.

I will check out readOnly again. I just think that confuses the users into thinking they are doing something wrong by not being able to type in the field, even though they tab into it. Disabled shows them pretty clearly they can't.

Thanks for the info.

scottmartin
21 Feb 2013, 1:24 PM
Setting this to false will prevent the field from being submitted even when it is not disabled.


Disables the submit when not disabled.

Farish
22 Feb 2013, 12:25 AM
If you just want the field to look disabled (and not the label), then you may use the following configs:


fieldStyle: 'background:#DDDDDD;', // makes the background gray giving a disabled effect to the user
readOnly: true

OR use the Scott's recommendation of cls: 'x-item-disabled'

mjhaston
25 Feb 2013, 10:27 AM
I didn't see Scott's suggestion of using "cls" so I ran with yours and this was as close as I could get ...



style : 'color:#B8B8B8;',
fieldStyle : 'background:#F0F0F0;border-color:#C8C8C8;color:#C8C8C8;',
readOnly : true




Then I saw Scott's suggestion and used his to keep it exact!

Thank you both.