Hi!
On Wed, 02 May 2012 20:56:18 -0300, Ryon Day <ryon_...@yahoo.com> wrote:
@property
private List<SelectModel> _questionSelectModels; // This is never null;
it's populated during onPrepareForRender();
@propertyprivate SelectModel _currentModel
Here is my Template:
<form t:type="form" t:id="questionsEnrollForm">
<loop t:source="questionSelectModels" t:value="currentModel"
t:formState="ITERATION">
Question: <select t:type="select" t:id="selected"
t:value="selectedQuestionId" t:model="${currentModel}" />
</loop>
<input type="submit" value="submit"/>
</form>
Result:Exception: Render queue error in
BeforeRenderTemplate[Enroll:selectedquestionid]: Parameter 'model' of
component Enroll:selectedquestionid is bound to null. This parameter is
not allowed to be null.
Here's what probably was your mistake:
<loop t:source="questionSelectModels" t:value="currentModel"
t:formState="ITERATION">
currentModel should be passed to the model parameter of Select, not value.
Loop's value is supposed to be a property which will store the current
object being iterated. The source parameter is the array or collection
being iterated, not the SelectModel.
Another problem:
<select t:type="select" t:id="selected" t:value="selectedQuestionId"
t:model="${currentModel}" />
The value parameter of Select is meant to be the value you're selecting,
aka, the object you want to select, so you don't need to use the object
id, you can use the object itself. Another problem is using ${} expansions
when passing parameters to components. Never, never, ever do that. This
causes the parameter value to be coerced to String and then this String
coerced to the type of the parameter.
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org