fields icon indicating copy to clipboard operation
fields copied to clipboard

f:all should pass extra parameters (including the input- ones) to field/input

Open livelock opened this issue 13 years ago • 7 comments

right now the new parameter passing only seems to work on field/input

livelock avatar May 30 '12 12:05 livelock

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.

robfletcher avatar May 30 '12 13:05 robfletcher

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

livelock avatar May 30 '12 13:05 livelock

Ok, I guess that's a fair point

robfletcher avatar May 30 '12 13:05 robfletcher

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.

cdeszaq avatar Aug 06 '12 19:08 cdeszaq

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.

atreides322 avatar Feb 03 '16 23:02 atreides322

Is there a solution for this? I am in the same situation as atreides322.

NBabineau avatar Mar 15 '16 16:03 NBabineau

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

mpccolorado avatar Apr 11 '16 13:04 mpccolorado