Hi! > I'm trying to use a radio component inside a ajaxformloop. My template looks> > like this:
Ok, I struggled a bit, and it took a while but I think I can guess what you are trying to do. You are creating an editor for a multiple choice test/questionnaire. You want to the test editor to be able to supply multiple answers to a question and choose one of them as being the correct answer. I don't think ajax updates to the RadioGroup where a consideration. I did a simple test and it appears that you can just provide an instance of RadioContainer in the addRow event handler: public String onAddRow() { environment.push(RadioContainer.class, new RadioContainer() { public String getControlName() { return "choices"; } public boolean isDisabled() { return false; } public String toClient(Object value) { return value.toString(); } public boolean isSelected(Object value) { return false; } }); return "Green"; } Josh On Sun, Nov 27, 2011 at 2:57 PM, Nefron <andrejstani...@hotmail.com> wrote: > Hi guys, > > I'm trying to use a radio component inside a ajaxformloop. My template looks > like this: > > <t:radiogroup t:id="radioGroup" encoder="encoder" value="correctAnswer"> > <t:ajaxformloop source="question.answers" value="answer" > t:id="answerLoop" encoder="encoder"> > > <t:radio id="radio" value="answer"/> > <t:beaneditor object="answer" t:id="answereditor" /> > > </t:ajaxformloop> > > </t:radiogroup> > > > Now, when I add another row to the form it fails with "No object of type > org.apache.tapestry5.RadioContainer is available from the Environment.". > > I first tried manually pushing the RadioGroup into the Environment from my > ajax event handler, but to my surprise it doesn't implement RadioContainer, > but instead creates it as an inner anonymous class. I'm curious, what is the > reason for this? > > Subclasing the RadioGroup is also not an option. > > The only way I see it now is copy pasting and editing the code from > RadioGroup. > > > How would I go about implementing this piece of functionality? > > > Thanks in advance. > > -- > View this message in context: > http://tapestry.1045711.n5.nabble.com/Radio-button-inside-ajaxformloop-tp5027367p5027367.html > Sent from the Tapestry - User mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org