Radio Button Group not work !!!!!

2 views
Skip to first unread message

fat...@tid.es

unread,
Nov 19, 2009, 6:39:30 AM11/19/09
to Google Wave API
This is not working for me 2 weeks ago:

1) Append elements to the formview.


blip.getDocument().getFormView().append(new FormElement
(ElementType.RADIO_BUTTON_GROUP, "radio_group"));

blip.getDocument().getFormView().append(new FormElement
(ElementType.RADIO_BUTTON, "radio_group","one"));

blip.getDocument().getFormView().append(new FormElement
(ElementType.RADIO_BUTTON, "radio_group","two"));

2) get the value.

choice = blip.getDocument().getFormView().getFormElement
("radio_group").getValue();

choice return the first element who have added to the
radio_button_group WHEN I HAVE NOT CLICKED ON THE RADIO.

Conclusion: THIS IS A BUG.




Olreich

unread,
Nov 20, 2009, 7:47:52 AM11/20/09
to Google Wave API
Maybe it's a bug, maybe they did it on purpose. I'm not sure, as I can
see both an "automatic" default value and "null" default value to
work. but, to make this fix simple, just throw a default value into
the constructor statement of your RADIO_BUTTON_GROUP.

To file a bug: http://code.google.com/p/google-wave-resources/issues/list

jhb

unread,
Nov 22, 2009, 2:18:24 AM11/22/09
to Google Wave API
This is not a bug, you are using the wrong constructor. If you have a
label, you need a defaultValue

public FormElement(ElementType type,
java.lang.String name,
java.lang.String defaultValue)

instead of

public FormElement(ElementType type,
java.lang.String label,
java.lang.String name,
java.lang.String defaultValue)

http://wave-robot-java-client.googlecode.com/svn/trunk/doc/index.html

fat...@tid.es

unread,
Nov 23, 2009, 4:03:16 AM11/23/09
to Google Wave API
Thank you, but I don´t think so. I used Polly Example and it worked 2
weeks ago:

http://google-wave-resources.googlecode.com/svn/trunk/samples/extensions/robots/java/polly/

Thomas Jungblut

unread,
Jan 4, 2010, 5:44:25 AM1/4/10
to Google Wave API
push!

Hi all,

I have the same problem. Here is an example:

textview.appendElement(new FormElement(ElementType.RADIO_BUTTON_GROUP,
"RBG"));

for(int i = 0; i < LIST.size(); i++)
{
textview.appendElement(new FormElement
(ElementType.RADIO_BUTTON,LIST.get(i),"RBG")); //(ElementType type,
String name, String defaultValue)
}

So everything is fine, the selection works great, but there is a
problem with the request.
-> getFormElement("RBG").getValue()

I know I've never set the value in the element, but there is no other
possible constructor to use. After I clicked on one radio button
(after using the other constructors), the page needs to be refreshed,
and there are no errors in my log.

I tried another way in the loop:

FormElement bla = new
FormElement(ElementType.RADIO_BUTTON,LIST.get(i),"RBG");
bla.setValue(LIST.get(i));
textview.appendElement(bla);

But the robot will give the first value in the radiobutton group.

The other "full" constructors requires a label. What is this label and
what is a verified input for it? I guess there could be the reason why
the page needs a refresh.
> FormElement(ElementType type, java.lang.String label, java.lang.String name, java.lang.String defaultValue, java.lang.String value)

Puh wall of text, I hope u'll get the gist.

Thomas Jungblut

unread,
Jan 4, 2010, 5:57:39 AM1/4/10
to Google Wave API
Shot update:
I tried to get this output: getFormElement("RBG").toString();

So it gave me this here:

{'type':'LABEL','properties':{name=RBG, value=listelement_value,
label=, defaultValue=listelement_value}}

And it doesn't matter what radio button I've selected.
I don't know wheter the problem is in the API or in my
implementation.
The values in my list are not similar to each other, I checked after
the appendElement(FormElement).

Thomas Jungblut

unread,
Jan 4, 2010, 10:18:20 AM1/4/10
to Google Wave API
Sorry for spam but I can tell you what's wrong:
I let the bot give out the list of formelements for the values etc.
and I found the right one

{'type':'RADIO_BUTTON_GROUP','properties':{name=RBG,
value=po...@appspot.com, label=, defaultValue=po...@appspot.com}

After manipulating the Radiobuttons, the value and defautValue
changed. So I think there is a problem within the API getting the
value out of the buttongroup.

Have a nice day!

Reply all
Reply to author
Forward
0 new messages