|
| A R C H I V E D M E S S A G E |
|
Subject: Denying the use of special characters in form input? |
| Posted: 11/21/2003 at 8:25:46 am |
| By: crevice |
| Is there a "best" method to deny the use of specified characters on a form? I have users inputting commas "," which of course causes havoc when the output is to a csv file.
-thanks | |
|
|
Subject: Re: Denying the use of special characters in form input? |
| Posted: 11/21/2003 at 9:22:16 am |
| By: crevice |
| Also, on my user returned data I'm getting an exclamation point "!" and a carriage return at the end of every 992 spaces. Ideally I'd like it to return lines of ANY length. | |
|
|
Subject: Re: Denying the use of special characters in form input? |
| Posted: 11/21/2003 at 9:51:39 am |
| By: Seth Knorr |
| Good Question, Actualy the coma will create problems in your csv file if you do not use a text qualifier like a quote. I did have a filed in the script that replaced commas with ; but it got confusing for people, However since if you use a text qulifer it fixed the problem.
Also the carrage return after 992 spaces is that in the data file or the email back.
Let me know if that helps.
Seth | |
|
|
Subject: Re: Denying the use of special characters in form input? |
| Posted: 11/21/2003 at 12:30:11 pm |
| By: crevice |
| The 992 ! is in the email back. Odds are it may be some limitation on the part of either the mail client, mail server, or somewhere else along the network.....possibly. But if you have an idea let me know please.
Thanks | |
|
|
Subject: Re: Denying the use of special characters in form input? |
| Posted: 11/24/2003 at 8:01:15 am |
| By: crevice |
| Okay!
I solved the issue with disallowing commas from the form input through use of a little javascript:
First I check for javascript
<!---javascript data validation --->
<script>
var isNS4 = (navigator.appName=="Netscape")?1:0;
</script>
<!---end javascript data validation --->
Then I use the following field input declarations (examples)
This input code allows only numbers, colon, dash, space and backspace
<br>
<input type="text" name="time" onKeypress="if(!isNS4){if ((event.keyCode > 32 && event.keyCode < 45)||(event.keyCode > 45 && event.keyCode < 48) ||(event.keyCode > 58)) event.returnValue = false;}else{if ((event.which > 32 && event.which < 45)||(event.which > 45 && event.which < 48) || (event.which > 58)) return false;}"></textarea>
<br>
This input field will not accept commas but will accept any other higher character:
<br>
<input type=text name=txtEmail onKeypress="if(!isNS4){if (event.keyCode==44) event.returnValue = false;}else{if (event.which==44) return false;}"> <br>
Okay, so -that- problem is solved.
Now I'd like the code to return the actual ascii symbols in its data rather than the hex substitutions (i.e. %37,etc.)
What I'd like to do is insert something like the following into the bizmail.cgi
would this work?
s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg
Thanks... | |
|
|
Subject: Re: Denying the use of special characters in form input? |
| Posted: 11/24/2003 at 9:47:57 am |
| By: crevice |
| DOH!
Just realized you already have that line in the code of the update!
Argh!
...so will the following line convert those "+" signs to space?
$value2 =~ s/(\+)+/( )/g;
Thanks... | |
|
|
Subject: Re: Denying the use of special characters in form input? |
| Posted: 11/24/2003 at 11:46:09 am |
| By: Seth Knorr |
| Yes, the last update will that plus correctly re-format all other charachters.
Seth
| |
|
|
Subject: Re: Denying the use of special characters in form input? |
| Posted: 11/26/2003 at 6:47:52 am |
| By: crevice |
| Hey,
I still get an "!" placed as the 992nd character of data returned. The file then goes to the second line and once again at 992 I get the ! and on to the next, etc.
Essentially it looks like an end of line marker. It's gotta be coming from the script as it's being set in the attachment and of course sendmail wouldn't alter an attachment.
Any ideas? | |
|
|