[html-formfu] Bug?
Octavian Rasnita
orasnita at gmail.com
Fri Jun 25 12:09:34 GMT 2010
Hi Carl,
From: "Carl Franks" <fireartist at gmail.com>
> 2010/6/25 Octavian Rasnita <orasnita at gmail.com>:
>> Hi,
>>
>> I have a form with the following element:
>>
>> <elements>
>> name date_time
>> type DateTime
>> label Date:
>> <constraints>
>> type Required
>> </constraints>
>> </elements>
>>
>> It generates the following error:
>>
>> Caught exception in MyApp::Controller::Admin::Comunicate::BNG::AGI->edit
>> "Not a HASH reference at e:/usr/site/lib/HTML/FormFu/Util.pm line 495.
>> at e:/usr/site/lib/Catalyst/Controller/HTML/FormFu/Action/FormConfig.pm
>> line
>> 42"
>>
>> It works if I use it with other elements than Date and DateTime (like
>> Text,
>> Button, Checkbox, Textarea, Select...).
>>
>> It also works with all elements if I use only:
>>
>> <constraints>
>> </constraints>
>>
>> or with:
>>
>> constraints Required
>>
>> It also works fine if I use more constraints, like:
>>
>> <constraints>
>> type Required
>> </constraints>
>> <constraints>
>> type Word
>> </constraints>
>>
>> I prefer to use the syntax with <constraints>...</constraints> even when
>> there is only a single constraint, because it is more consistent.
>>
>> A syntax like the one below is not valid and it gives errors:
>>
>> constraints Required
>> <constraints>
>> type Word
>> </constraints>
>
> Can you confirm you get the error when loading just that snippet of
> config?
>
> <elements>
> name date_time
> type DateTime
> label Date:
> <constraints>
> type Required
> </constraints>
> </elements>
>
> I copy/pasted it, and it loads without errors.
> I've also tried upgrading to the latest version of Config::General,
> and that made no difference.
>
> Carl
Yes I tried it, and it gives the same error, because in the configuration
file I have:
'Controller::HTML::FormFu' => {
constructor => {
default_args => {
elements => {
Date => {
constraints => [
{
type => 'DateTime',
parser => {strptime => '%Y-%m-%d'},
},
],
},
DateTime => {
constraints => [
{
type => 'DateTime',
parser => {strptime => '%Y-%m-%d %H:%M:00'},
},
],
},
},
},
},
}
I see that there is constraints => [
so the constraints key is not a hashref indeed, and I think that this might
be the cause of the error, but I think it shouldn't be a hashref, because
there may be more constraints.
This code was working until some time ago, but now it gives that error.
Should I change the data structure for these settings?
If yes, please tell me which is the correct syntax.
If you want, I can send you a sample Cat app which gives that error.
Thank you.
Octavian
__________ Information from ESET NOD32 Antivirus, version of virus signature database 5228 (20100625) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
More information about the HTML-FormFu
mailing list