Hi There.
Im very simply trying to code for my first radio button that I have placed on the form. I added the radio button to the form and called it “search type” and attached a value list containing only 2 entries to it (“by phone” and “by city”). It displays properly on the form when I run it which is good.
Question: how to I programatically obtain which of the 2 radio buttons is selected at runtime? If I look at the options avail under elements..blah… there doesn’t seem to be much to help me.
I’ve looked through the wiki pages however when you seach on radio button it all seems to make reference to “menu” values so I think the documentation is wrong. (http://wiki.servoy.com/display/Serv52/RadioButton)
Any suggestions as to where to start? does anyone have any code examples they could post?
Kevin
The dataprovider of the radio button element holds the selected value. If you haven’t provided one, you can create a form variable and assign it to the radio button element. Now you can use the form variable to determine the selected radio button.
I see this is your first post in this forum. So welcome to this servoy community…
What I understood from the post is, you have placed a radio button and attached a valuelist with values (““by phone” and “by city””) and hope you have set the return values as display values while creating the value list.
To obtain the value of the selected item from the radio button, there should be a dataprovider (either database field or form variable) attached to it of TEXT type(as returning the text).
Yes, my first post. Thanks for the welcome and replies.
Ah… such a simple solution and it works perfect. I suppose I thought “data provider” was more of a way to SET the value of a field on the form rather then the data provider field being SET by some input on the form. But now that you explain it, it makes total sense.