views:

43

answers:

1

I have a text field that is disabled based on who the user is. When the page submits, the value of the text field is supposed to be inserted into a SQL table, but SQL seems to see the value as empty because the text field is disabled. Can anyone tell me a way to get this value into SQL, i.e. for SQL to actually see the value? Below is the code for my text field. The SQL code is just an insert. Thanks!

<input type="text" name="txtWorkOfDate" id="txtWorkOfDate"<%
...
If vIsManager = 0 Then
  Response.Write "Disabled style='background-color:#E8E8E8'"
End If %>

value="<%=(RSMain("IPIssueWorkOfDate"))%>">
+3  A: 

Use readonly instead of disabled if you want the browser to send you the value. But note that it doesn't stop the user from modifying/sending it some other way (even with disabled). You need to verify that the user can save the value on the server side, but then you can't use the value the browser sent to you.

Lukáš Lalinský
The readonly worked. Thanks. I'm not sure I understand what you mean though when you say this: "You need to verify that the user can save the value on the server side, but then you can't use the value the browser sent to you." Can you explain? Thanks!
baldwingrand
My browser might allow me to edit `readonly` fields, or I might send a POST request to the server without using a browser with any value I want. Basically, you can't assume that using `readonly` or `disabled` means that the user can't change the value.
Lukáš Lalinský
Ah, gotcha. Thanks so much for your help!
baldwingrand