One more piece of information:
If I put my checkboxes inside the main HTML template, which contains the
form, the values are available in the listener method as expected. Is it
possible to make a component update the bound page properties before
calling a page listener? I'm guessing this is done using the
direction="form", but as I mentioned, I get a ClassCastException when
the form submits:
Stack Trace:
org.apache.tapestry.param.AbstractParameterConnector.resetParameter(AbstractParameterConnector.java:148)
org.apache.tapestry.param.ParameterManager.resetParameters(ParameterManager.java:124)
org.apache.tapestry.AbstractComponent.cleanupAfterRender(AbstractComponent.java:932)
Inge
Inge Solvoll wrote:
Hi!
I'm trying to do the following:
I have a ListEditMap in my form, which contain a collection of objects.
Each of these objects are potentially different types, but all inherit
from a common type. I have made a component which takes the current
object as a parameter, checks its type, and includes the appropriate
display component for that type, because each type needs its own HTML
template. The code looks like this:
In the main HTML file (both parameters have direction auto,
questionsEdit is a ListEdit component):
<span jwcid="questionsEdit"> <span jwcid="@QuestionDispatcher"
question="ognl:currentQuestion"
listEditMap="ognl:questionsEditMap">Question
title</span> </span>
The component that "dispatches" to the specific HTML template:
<tr>
<td width="20" valign="top" jwcid="@InsertImage"
img="check-box-bg.gif" bgcolor="#FFFFFF"><div align="center">
<input type="hidden" jwcid="@Hidden" value="ognl:question.id"/>
<input type="checkbox" jwcid="@checkboxes:ControlledCheckbox"
selected="ognl:listEditMap.deleted"/>
</div></td>
<td colspan="2" jwcid="@InsertImage" img="dotted-line-horizontal.gif"
bgcolor="#FFFFFF"><span class="body-text-header">
<span jwcid="@Insert" value="ognl:question.name">Question
title**</span>
<span class="body-text"><br>
<span jwcid="@InsertText"
value="ognl:question.description">Question description**</span>
<br> <br>
<span jwcid="@Conditional" condition="ognl:question.type == 'Choice'">
<span jwcid="@ChoiceQuestion" question="ognl:question">Choice
question here</span>
</span>
<span jwcid="@Conditional" condition="ognl:question.type == 'Text'">
<span jwcid="@TextQuestion" question="ognl:question">Text question
here</span>
</span>
The included components ChoiceQuestion and TextQuestion are pure
HTML-components without java-code, with the parameter question,
direction=auto.
I guess I can stop here, because this is enough to cause me trouble. The
problem starts with the checkboxes when the form is submitted. This is
probably a well known pattern to most of you, so I will describe it
here, to make me look stupid:)
1. The listener method for my "saveQuestions" functionality is called
2. The listener method for my ListEditMap that synchronizes the value of
the current iteration (like in the Tapestry in action-vlib) is called
for each element.
What I need is something that makes the form values update, also the
ones inside included components containing form elements, before my page
listener method is called. I have tried to change the binding directions
to "form", but this causes a ClassCastException when resetting
parameters on form submit.
Any ideas? I can add more details if this wasn't clear enough.
Thanks
Inge
---------------------------------------------------------------------
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]