Why does my input type=text value get truncated?
When you insert values into textboxes dynamically, you have to remember the same rules that hold true for basic HTML. When you use a string, you must store it within quotes to prevent premature concatenation. :-)
One thing you want to be careful of is embedded quotes. You might try using ' or " as the delimiter, and eliminating the other for possible entry (using client-side validation of course; the value is destroyed before you'd be able to validate for it on the server side). If you have to allow both ' and ", you could consider using the rarely used "back-apostrophe" (`). You can also try to user Server.HTMLEncode() on the value, before slipping it into the HTML element.
If you do this:
This evaluates to:
And everything after 'foo' is ignored, because the browser interprets that as the end of the string.
Related ArticlesHow can I mimic a client-side POST from ASP?
How do I cause/prevent ENTER being used to submit a form?
How do I change the target frame or window of a response.redirect?
How do I disable certain FORM elements?
How do I disable IE's Autocomplete feature?
How do I iterate through a form collection?
How do I make form fields read-only?
How do I make one dropdown depend on another?
How do I pass x-y coordinates to ASP, after the user clicks an image?
How do I perform spell checking from a web page?
How do I retrieve the name of the form that was submitted?
How do I retrieve the text and the value from a <SELECT> element?
How do I submit forms to a new window, with window.open() features?
How do I upload files from the client to the server?
How do I validate a credit card number in ASP?
How do I validate forms using server side script?
What is the limit on Form / POST parameters?
What is the limit on QueryString / GET / URL parameters?
What is the size limit of a posted FORM field?
When I have multiple submit buttons, how do I tell which was clicked?
Which should I use: Request("item") or Request.Form("item")?
Why can't I access Request.Form() when uploading?
Why can't I pre-populate INPUT TYPE=FILE element?
Why do I get 'HTTP 405 - Resource Not Allowed' errors?
Why does my form variable become 'value, value' instead of 'value'?
Why won't my <TEXTAREA> display the data I passed to it from ASP?