[ic] Stripping CR/LF from form input

DB DB at M-and-D.com
Sat Apr 22 23:12:57 EDT 2006


I have a form that allows users to update a "notes" field which I've
added to my transactions table. Sometimes users hit the Enter key while
they're adding input to the form. These carriage returns cause problems
for me and I need to remove them.

I wrote a custom filter that I think should do that. Here is that filter
which I added to my catalog.cfg (version 5.4)

# filter to strip "returns" from coments
CodeDef no_crlf Filter
CodeDef titlecase Routine <<EOR
 sub {
 my $val = shift;
 $val =~ s/[\x00-\x1F]+/ /g;
 return $val;
 }
EOR


My form shows the notes field in a textarea which allows the user to
edit the contents:

<TEXTAREA NAME="notes">
[data table=transactions col=notes key=[loop-code]]
</TEXTAREA>

and I thought that changing it to this would accomplish my goal

<TEXTAREA NAME="notes">
[filter no_crlf]
[data table=transactions col=notes key=[loop-code]]
[/filter]
</TEXTAREA>

but it seems to do nothing. I can still update the field but the
troublesome carriage returns are not stripped. Can anyone assist?

DB


More information about the interchange-users mailing list