-
1. Re: Generate a Dynamic Form : advice needed
danielc.roth Jun 12, 2008 12:31 PM (in response to laurent4x_x52)I would probably have built small facelet compositions per
part
which were included/excluded with the rendered-flag in themother
-composition. -
2. Re: Generate a Dynamic Form : advice needed
laurent4x_x52 Jun 12, 2008 12:55 PM (in response to laurent4x_x52)Hello Daniel;
But how do you deal with the fact that there can be let say
2 input fields then one group of check boxes then 1 other input
and for a second entry could be just a text area ?
I can't just put composition by design timeindeed, the order AND the type of the dynamically-rendered fields are set on runtime
may be on composition I can use EL to design the part; then
I put let'say 50 composition tag on my mother-page then some style of<ui:include
or <ui:composition with template=#{formDefinition.get1stType}>
#{formDefinition.get2ndType; #{formDefinition.get3rdType} and so on for let say may maximum of 50 fields per page.Not really nice but may be it can works if the EL is permitted in this case ?
So the rendered-flag will strictly be used only as a property of a field depending on some extra meta data filled in formDefinition.get1stMetadata ..to.. formDefinition.get50thMetadata
What do you think about it ?
-
3. Re: Generate a Dynamic Form : advice needed
cjalmeida Jun 12, 2008 9:14 PM (in response to laurent4x_x52)My 2cents,
1) You can use either JSF UI bindings or a mix of ui:include and ui:repeat.
<ui:repeat value="#{formDefinition.types}" var="type"> <ui:include template="#{type.template}" /> </ui:repeat>
2) Don't try to force the old paradigm when changing technologies. Think again and again if such
feature
is needed. -
4. Re: Generate a Dynamic Form : advice needed
laurent4x_x52 Jun 12, 2008 10:13 PM (in response to laurent4x_x52)for your 2nd point :
Yes ! unfortunately I have to !
It's one the application main feature
The application claims to let user add custom fields when defining their main entities;So the real content of my entities can not be guessed by compile time. You have to go grab some data from the configuration table to know what the Admin user had set up.
And then must create your form (input/output) according to thisI'm going to go read some resource; then start to try ! What I'm trying to do here is ask and get some good advice about what should be
best fit
and most important what is known for sure to be useless and dead-end !!
It can save some time not only for me I think this subject can be of interest to others also.So thanks for your first point ! It is the kind of thing I was thinking about.. good to know it seems reasonable.
-
5. Re: Generate a Dynamic Form : advice needed
cjalmeida Jun 13, 2008 12:57 AM (in response to laurent4x_x52)I can see the business case of your request.
If ui:include does not suit you, using ui:fragment and the binding attribute might be a more powerful alternative.
<ui:fragment binding="#{component}" />
And you dynamically create the components in Java:
import javax.faces.component.* import javax.faces.component.html.* public UIComponent getComponent() { if (type=NORMAL_TEXT) { HtmlInputText txt = new HtmlInputText(); txt.setValue("hello jsf"); return txt; } else if (type=CUSTOM_DATE){ MyCustomDate c = new MyCustomDate(); c.setValue(new Date()); return c; } ... }
-
6. Re: Generate a Dynamic Form : advice needed
przemjaskier Jun 13, 2008 11:10 AM (in response to laurent4x_x52)Cloves,
1) Will not work. It would work with c:forEach, but not ui:repeat. Using c:forEach brings a lot of pain, though.
Dynamic templating sucks in facelets bigtime.
-
7. Re: Generate a Dynamic Form : advice needed
etaham Jun 19, 2008 10:16 PM (in response to laurent4x_x52)Has anyone come up with ideas on how to get around the <ui:repeat> with <ui:include> problem?
-
8. Re: Generate a Dynamic Form : advice needed
laurent4x_x52 Jun 20, 2008 9:43 AM (in response to laurent4x_x52)I didn't get the time to work on it yet;
should be next week BUT I've seen this post :http://www.seamframework.org/Community/DynamicCRUDWithFaceletsCompositeTemplatingAndCustomEL
He did what we are thinking about I asked on his thread to give us some hints about the ideas .
go on his thread; try it out and please : let us know if you succeed !
The more we share on this the best it will be
Regards -
9. Re: Generate a Dynamic Form : advice needed
sjmenden Jun 20, 2008 3:16 PM (in response to laurent4x_x52)
Dynamic templating sucks in facelets bigtime.Dynamic templating sucks until you
get it
then the possibilities are endless, truly, more soon.