Is there any way in Java that you can disable the enter key when filling out a form thru a cgi script. When the person fills out the form on the web and hits the enter key it messes up the output to the text file. Please let me know.
2- what do you mean with : filling out a form thru a cgi script ?
- the cgi script fills out the form and then sends it to the client : where does the keypress event can happen ??
- the users fills a form and when s/he presses enter, the form submits itself : where is the cgi ? you mean, you want the form NOT to submit if the user presses the enter key ?
When someone hit the enter key in the comments space on a form with the cgi script in the background it messes up the log file and when I try to import into access it imports into multiple records instead of one. I saw a java progammer use a routine that disabled the right mouse click so you can't get to the code in back of the page. I was wondering if there was any way to disable the enter key so no one can enter on the form. Like have message pop please do not use the enter key.
I think your only problem is that you need to set a parameter (WRAP) in the textarea tag so that hard returns entered into the textarea are NOT transmitted to the cgi program. Check this out (from NS devedge):
WRAP
specifies whether lines longer than the text area's column width wrap to the next line. Navigator 2.0.
The value of WRAP can be one of the following:
OFF disables word wrap. Text the user types is displayed with the exact line breaks that the user types. If the user explicitly inserts a line break, however, the break is included as part of the text area's value. The user has to scroll horizontally to see the ends of lines that do not fit in the text area element.
HARD causes word wrap, and the line breaks are included when the form is submitted. The text wraps inside the text area element, and that the user does not need to scroll horizontally.
SOFT causes word wrap, but the line breaks are not included when the form is submitted.
Looks like you need to use WRAP=SOFT.
Tracy Dryden
tracy@bydisn.com
I tried the wrap=soft in the html code and it still is not working!!! I tried hit enter a view time in the box and it gives me carriage returns in the log file.
If you want to prevent users from using carriage returns in textarea fields, have javascript search the contents of the textarea for "%0D%0A" (carriage return,line feed) before submitting the form.
Example:
if (escape(field_value_ref).indexOf("%0D%0A" >= 0) {
Iza, I have no idea if the solution we're using work's outside of windows or mac. Our application is not public and we don't have any of those users. I am hoping the escape function takes care of that ??
Thank you for all your help!! I put tleishs' idea on my website I changed the comments field from areatext box to just a regular text box now it works awesomely.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.