cubicweb #1624937 [form handling] easy access to form values [resolved]
While working recently on an ad-hoc form I noticed it was a bit hard to round-trip from _cw.form values to the actual form values. Either this is because of an API I'm not aware of, in which case we should add it to the cw doc, or we should provide an API to build a dictionary from _cw.form that extracts and preprocesses the values therein in a way which helps writing a proper form/controller/... form/... loop. e.g: {'foo': u'__internal_field_value', 'bar': u'42', 'baz': u''} would become: {'bar': [42], 'baz': None} for a class Form(...): foo = ff.StringField(...) bar = ff.StringField(widget=fw.Select(multiple=True)) baz = ff.BooleanField(allo_none=True) You get the idea. This could be a method on form such as: form.process_form_values(self._cw.form) | |
priority | normal |
---|---|
type | enhancement |
done in | 3.13.1 |
load | 0.500 |
load left | 0.000 |
closed by | <not specified> |
Comments
-
2011/04/15 06:03, written by sthenault
-
2011/04/15 08:12, written by acampeas
-
2011/04/15 08:46, written by sthenault
-
2011/04/15 08:50, written by acampeas
add commentwhat you've currently is field.typed_value(form)
isn'it enough ?
where's the input dict ?
?
the one in: