[ic] Stripping CR/LF from form input

DB DB at M-and-D.com
Sun Apr 23 10:55:41 EDT 2006


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

> $val =~ s/[\r\n]+/ /g;

> 
>>  return $val;
>>  }
>> EOR
> 
> You realise that you're adding in linefeeds here (one above the data and 
> one below)?  Try it as one line instead.
> 
>> <TEXTAREA NAME="notes">
>> [filter no_crlf]
>> [data table=transactions col=notes key=[loop-code]]
>> [/filter]
>> </TEXTAREA>
> 
> Peter


Hi - thanks for the reply. I tried changing the filter to your version,
and doing the filter all on one line (actually it was on one line
already but I posted that way because of the way it was wrapping). It
still does not do the job - again I can make updates to the field but
the carriage returns are not removed. I must be missing something?

The odd part is that if I just display the notes field on the form, the
carriage returns don't appear. But if I do a

select notes from transactions where order_number=1000

they are indeed present. My life would be improved if I could get rid of
these!

DB


More information about the interchange-users mailing list