Issue
I have a read-only asp:textbox
in my form whose the contents change by means of client-side JavaScript. When the form is submitted, the textbox’s contents are lost, probably because it’s read-only. Is there a way to have the textbox’s contents remain intact?
Cause
Unlike values for disabled controls, read-only control values are submitted with the form data set. However, it is at this point that WorkflowGen identifies the field as read-only and does not accept the value, regardless of how the contents were entered or altered on the form. Whether the form element is defined as read-only in WorkflowGen or within the form itself, the behavior is the same.
Solution
Add the following JavaScript code to your asp:textbox
:
onfocus=this.blur() onclick=this.blur()
This will prevent the textbox from getting the focus (cursor) should the user try clicking in it or by means of the Tab
key (Tab Index).