[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ic] Stripping CR/LF from form input


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
_______________________________________________
interchange-users mailing list
suppressed
http://www.icdevgroup.org/mailman/listinfo/interchange-users


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.