[html-formfu] Model HashRef zeroing of all values

Nigel Metheringham nigel at dotdot.it
Sun Mar 20 21:17:05 GMT 2011


When a Model HashRef is used to set the form defaults, any values
that were set in the original config/populate are overwritten
even if there is no key for that item in the defaults hash.

I have modified one of the standard tests to show this up - patch
attached.

I tried stripping the code in HTML::FormFu::Model::HashRef default_values
to not undef all existing values at the start of processing (patch 
attached), but this has side effects if a form is re-used - and so
breaks one test in t/model/hashref_create.t

I suppose one solution is to stash all the existing values at the
process stage or the first time into HTML::FormFu::Model::HashRef 
default_values and use those to reset the form each time into
default_values, or to live with the behavioural change.

Oh, and in case its not clear as to why this is a problem, I have all
my forms with the submit buttons defined like this:-
     - label: ''
       value: Edit
       name: submit
       type: Submit
     - label: ''
       value: Cancel
       name: cancel
       type: Submit

Those buttons both appear with the legend "Submit" if the model kills
off the values...

	Nigel.

--
[ Nigel Metheringham ------------------------------ nigel at dotdot.it ]
[                 Ellipsis Intangible Technologies                  ]

-------------- next part --------------
A non-text attachment was scrubbed...
Name: model_hashref_test.patch
Type: application/octet-stream
Size: 972 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/html-formfu/attachments/20110320/68e3ff9f/model_hashref_test.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: model_hashref.patch
Type: application/octet-stream
Size: 926 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/html-formfu/attachments/20110320/68e3ff9f/model_hashref.obj


More information about the HTML-FormFu mailing list