in your Question component, you can use blocks. Each block with another
component. You render the Block that suits the "questionType" : boolean,
enumeration, text, date etc.
<span jwcid="@RenderBlock" block="ognl:block"/>
<span jwcid="checkboxBlock">
<span jwcid="@InsertText" value="ognl:question.text"/>
<span jwcid="@Checkbox" value="answer.value"/>
</span>
...
public IComponent getBlock() {
int qt = getQuestionType8);
switch (qt) {
case 0 : // boolean
getCheckboxBlock();
...
...
cheers,
Ron
ציטוט tom:
Thanks for the quick reply. I believe this will help. However, a larger problem
seems to be conditional display and validation. Is there a way to specify
conditional behavior? What I mean is that suppose I have queried my db for the
questions to display on the form and I get back something like:
ID Text Type DataType
123 How many widgets do you want? TextField Numeric
124 What's your favorite widget color? TextField String
125 Do you ski? Checkbox Boolean
I will then package this data into some kind of collection of objects and make
this available to my Tapestry page.
I see that it is possible to display these form elements. Is it possible to show
different types of form elements based on the Type? Furthermore, is it possible
to use the Tapestry validation mechanism that is appropriate for a DataType
conditionally based on the DataType returned?
I know how this type of situation is handled in CF. It usually requires a lot of
hand coding of html and if-thens in a loop. Tapestry is much more elegant in how
it handles Web forms, etc. so I am hoping that there is an equally elegant
solution for my problem.
Forgive me for asking so many questions. I do not see any type of article
anywhere on the internet even slightly similar to my query. I very much
appreciate the insights of the users on this list.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]