Friday, November 19, 2010

Simulate disable or readonly textbox with no focus

if we make the textbox disabled="true" then its value does not post back to the server and if we make it readonly="true" then it depends on browser to post back the value or not but any value change we make on client side, will be lost on the server side. if you want to have a textbox or html input text and you want it disabled or readonly and need to manipulate the value on client side and also post the value back to server, we can use something like this:

<input type="text" id="txtAmount" value="$0.00"
style="border:solid 1px Black;width:100px;background-color:#D1D1D1" onfocus="this.blur();" />

1 comments:

Jack said...

You are right. If we make textbox disabled ="true", in that case, we can't write any value for it and in fact, does not post back to server. While readonly = true means that we can only read value assigned to textbox but can not assign any new value for it.
pdf digital signature

Post a Comment