I have a textarea field in a form. I want to remove any hard returns the user may have entered before I pass the field on to my CGI program. The wrap parameter does not seem to make any difference to the value of the textarea data. So I figure you have to do with with a validation function. Fair enough.
Certainly I am not the only person who has tried to do this.
Apparently, you have to look for both a return - \r - and a new line - \r
But, according to Danny Goodman, Windows, Unix, and Macintosh handle a hard return differently. He suggests using the escape method to return the equivalent %OD or &OA. But then I have to get get rid of the %OD or %OA. I do not see that that helps, except that it does make the field all one line.
I can create a loop, scanning each character for a \n or \r and replacing either with a space. That should work in any platform.
But there must be a faster way to do it with regexp that will work in any platform. But I can find no source that references this, with or without using regexp.
This should be a basic issue related to forms processing.
Am I really the only person who has tried to do this?
Thanks.
Certainly I am not the only person who has tried to do this.
Apparently, you have to look for both a return - \r - and a new line - \r
But, according to Danny Goodman, Windows, Unix, and Macintosh handle a hard return differently. He suggests using the escape method to return the equivalent %OD or &OA. But then I have to get get rid of the %OD or %OA. I do not see that that helps, except that it does make the field all one line.
I can create a loop, scanning each character for a \n or \r and replacing either with a space. That should work in any platform.
But there must be a faster way to do it with regexp that will work in any platform. But I can find no source that references this, with or without using regexp.
This should be a basic issue related to forms processing.
Am I really the only person who has tried to do this?
Thanks.