fields
fields copied to clipboard
f:all should pass extra parameters (including the input- ones) to field/input
right now the new parameter passing only seems to work on field/input
I'm not sure I agree with this. It would be very unusual to want to pass the same parameters to every field. Such parameters are used to customize the rendering of individual fields or inputs, e.g. to put a autofocus attribute on to an input.
Yeah and also to add some extra classes etc, if you work with twitter bootstrap or similar, right now i have to repeat it over and over. Like here you need a selector for an accordion/collapse element. <f:with bean="recommendationInstance"> <f:field property="a1" parentContainer="accRec" extraClasses="in"/> <f:field property="a2" parentContainer="accRec" /> <f:field property="a3" parentContainer="accRec" /> <f:field property="a4" parentContainer="accRec" /> <f:field property="a5" parentContainer="accRec" /> /f:with
Ok, I guess that's a fair point
In general, any "upper-level" tag that calls "lower-level" tags should be passing any "unknown" parameters on down to the lower tags. The danger in this is that introducing new "known" parameters at any given level might possibly conflict with others that might be being passed in.
As long as this is well documented, however, I don't see this being much of a problem in reality.
I am running into a mix of this and #141. I need to add class="form-control" to every single input, thanks Bootstrap. I could use widget-class="form-control", but it would be redundant and I wouldn't be able to use f:all. My other option is to provide my own _widget.gsp for all the various data types, but that duplicates all the logic in FormFieldsTagLib and FormTagLib.
Is there a solution for this? I am in the same situation as atreides322.
See my pull request #211 . Follows the convention for passing attributes ( prefixed with widget- for widget attributes ).
You can use it on <f:all> and <f:with> tags