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 ------------------------------ ni...@dotdot.it ]
[                 Ellipsis Intangible Technologies                  ]

Attachment: model_hashref_test.patch
Description: Binary data

Attachment: model_hashref.patch
Description: Binary data

_______________________________________________
HTML-FormFu mailing list
HTML-FormFu@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu

Reply via email to