Hi again,
Upon my attempt in making a barebone example I realized my error
report was not exactly correct: the value js_invalid_hidden in messages
is indeed effective (but it is not used in any case and no default is
defined in Messages.pm). I was using 3.0201, but upgrading to 3.0202
didn't fix the problem. Anyway, here is the snippet (pass ?id=1 on the
url to trigger the warning in error log):
-------------------------------------------------
#!/usr/local/bin/perl
use strict;
use CGI;
use CGI::FormBuilder;
my $query=CGI->new;
my $id=$query->param('id');
my @fields=qw/role/;
my $form=CGI::FormBuilder->new(
method=>'POST',
name=>'test',
fields => \@fields,
reset=>0,
validate=>{
id=>'VALUE',
role=>'VALUE',
},
required=>[qw/id role/],
messages=>{
#js_invalid_hidden=>'Server problem: "%s" is not valid. Please
contact IT Development',
},
);
$form->field(name=>'role',type=>'select',options=>[qw/CUSTOMER
INTERNAL/]);
$form->field(name=>'id',type=>'hidden',value=>$id);
print $query->header;
print $form->render;
-------------------------------------------------
> -----Original Message-----
> From: Nate Wiger [mailto:nwiger@xxxxxxxxx]
> Sent: Monday, June 06, 2005 23:24
> To: Liu, Aaron
> Subject: Re: js_invalid_hidden not defined
>
> Can you send me that script, or at least a code snippet? And are you
> running 3.0202?
>
> On 6/5/05, Liu, Aaron <aaron.liu@xxxxxxxxxxxxxx> wrote:
> >
> > I got a hidden field that should be propagated in the form
> > between submission and I wanted to make sure it is there.
> So I have put
> > it in the required field with validate check as 'VALUE'. The error
> > occurs during form rendering only. When I submited the form
> eventually
> > it passed without perl/javascript error and passed validate
> function.
> >
> > > -----Original Message-----
> > > From: Nate Wiger [mailto:nwiger@xxxxxxxxx]
> > > Sent: Friday, June 03, 2005 23:40
> > > To: Liu, Aaron
> > > Cc: fbusers@xxxxxxxxxxxxxxx
> > > Subject: Re: js_invalid_hidden not defined
> > >
> > > Liu, Aaron <aaron.liu@xxxxxxxxxxxxxx> wrote:
> > > >
> > > > I got Warning: No message string found for
> > > 'js_invalid_hidden'
> > > > in my error_log. When I look at Messages.pm there is no
> > > default for it,
> > > > and even if I define one during new() it didn't get used. I
> > > think this
> > > > comes from the line:
> > > >
> > > > my $et = 'js_invalid_' . ($type eq 'text' ?
> 'input' : $type);
> > > >
> > > > from sub jsmessage. Maybe it should use
> js_invalid_default instead?
> > >
> > > I'm confused - this would only be triggered if you're validating a
> > > hidden field and then it fails validation somehow. What
> are you doing?
> > >
> > > -Nate
> > >
> >
>
|