[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;

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

[data table=transactions col=notes key=[loop-code]]

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

[filter no_crlf]
[data table=transactions col=notes key=[loop-code]]

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


More information about the interchange-users mailing list