Robert Francis
asked on
Need to fill form textbox with value from recordset
I have an edit page that populates a form from a recordset. One of the values has a quote symbol (")in it and it stops the entire value from displaying in the text box. Here is some code:
So lets say the value in both the comments and the material is 1/2" steel. At the top of the page the response.write will display 1/2" steel twice. That is correct. But in the form the material textbox will display 1/2 and the comments will display 1/2" steel. Why does an input type="text" cut off the data but a textarea not? How do I stop this from happening.
<%
mSQL1 = "SELECT * FROM purchasing WHERE m_id = '" & Request.querystring("id") & "'"
Set rs1 = connectstr.Execute(mSQL1)
response.write rs1("m_comments")
response.write rs1("m_material")
%>
<form name="edit" method="post" action="request_edit_submit.asp?id=<%Response.Write rs1("m_id")%>">
<p><label for="txtMaterial">Material: </label><input type="text" name="txtMaterial" id="txtMaterial" value="<% = rs1("m_material") %>"><span style="margin-left:10px; color: red;">*This field is required</span></p>
<p><label for="txtComments">Comments: </label><textarea style="margin-left:15px;" name="txtComments" id="txtComments" cols="45" rows="5" ><% = rs1("m_comments") %></textarea></p>
<p> <input type="submit" class="nomargin" name="submit" id="submit" value="Edit Request"></p>
</form>
So lets say the value in both the comments and the material is 1/2" steel. At the top of the page the response.write will display 1/2" steel twice. That is correct. But in the form the material textbox will display 1/2 and the comments will display 1/2" steel. Why does an input type="text" cut off the data but a textarea not? How do I stop this from happening.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.