[jifty-devel] canonicalize_ ajax call not doing the right thing
Peter Mottram
peter at sysnix.com
Sat Jan 5 08:50:43 EST 2008
I'm seeing some weirdness when using canonicalize_ inside my model as
there is a difference between how the ajax call handles things (badly) and
how the final POST request handles things (correctly).
Here's an extract of the relevant parts of my model:
<code>
package MyApp::Model::Product;
use base qw(MyApp::Record);
use Jifty::DBI::Schema;
use MyApp::Record schema {
column partnumber =>
type is 'text',
label is 'Product Number',
max_length is 12,
is mandatory,
is distinct;
}
sub canonicalize_partnumber {
my $self = shift;
my $value = shift;
$value =~ s/[\s\W]+//g;
Jifty->log->info(qq(x${value}x));
return uc($value);
}
</code>
And here is an extract from the log during a session in which I set the
partnumber to ';s' (the semi-colon should be removed and then the string
then uc'd):
<log>
INFO - GET request for /__jifty/validator.xml
INFO - xx
INFO - POST request for /product
INFO - xsx
INFO - xSx
</log>
So the ajax validator sees an empty value! If I enter somthing nice and
simple like '45th e4' then the result via ajax is correct as it returns
'45THE4'.
Could someone please point me in the right direction as to where to start
poking around in the Jifty code?
Cheers
PeteM
More information about the jifty-devel
mailing list