Re: Radio button inside ajaxformloop

2011-11-29 Thread Nefron
Hey, thanks for responding. 

You guessed correctly. I'm creating a tests and quizzes application that
should be used to test students at my university.

I already tried something similar to the stuff from your response,
unfortunately it doesn't work as expected. The row gets added this time, but
the radio buttons act like they aren't a part of the same radio group. I
guess this is because only one row is updated with the ajax request, so the
radio group and other boxes don't know about the change.

Anyway, I found a workaround that involves submitting the form. 

The addrow and remove links submit the whole form via ajax and I do the
stuff I need to differentiate between actions I should take in those
onSelected event handlers. 

The tml looks like this:


 












Correct


 Remove Row 




 Add Row











--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Radio-button-inside-ajaxformloop-tp5027367p5034294.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



Re: Radio button inside ajaxformloop

2011-11-28 Thread Josh Canfield
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  wrote:
> Hi guys,
>
> I'm trying to use a radio component inside a ajaxformloop. My template looks
> like this:
>
> 
>             t:id="answerLoop" encoder="encoder">
>
>                
>                
>
>            
>
>  
>
>
> 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



Radio button inside ajaxformloop

2011-11-27 Thread Nefron
Hi guys, 

I'm trying to use a radio component inside a ajaxformloop. My template looks
like this:









 


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