Getting the value of a Radio Button in Xpages.
Category Xpages
This is a long story for a relatively short answer. Sorry about that...
Recently I was working on a test XPage application and wanted to have a page that would let the users fill out some fields and then it would create a document in the "backend" using server side Javascript and send the document to a team HelpDesk e-mail account. I would not be saving this document in the application.
On this page I wanted to have a simple Radio button with the choices Low, Medium, and High. The user would choose the level of their problem and I'd include that in the e-mail. However, I hadn't used Radio Buttons up to that point. Especially in the case that I wasn't really saving the XPage. I only wanted to get the value to the backend document that would be mailed.
I had some problems trying to figure out how to get the value. You see, when you're dealing with individual radio buttons on an XPage, each option is it's own component and when you drop them on a page each has it's own unique name. This is not like the Notes Client where you have one Field of the type "Radio" with multiple options inside it. Hmmm.. I know in traditional Javascript you need to iterate through a control looking for the checked property. But what do you do here?
I first tried to get the value of the selected button by trying to do a getComponent on the group name.
var choice = getComponent("groupName")
Well that didn't get me to far. So I shouted out on twitter and got some good suggestions. The best might have been to ask Matt "Mr. XPages" White himself, but really this has to be solvable by us mere mortals. Paul Hannan noticed that I didn't have "getValue" at the end of my statement. Whoops. I do keep forgetting that so I gave this a try:
var choice - getComponent("groupName").getValue()
Still no Joy. Declan suggesting I look at the Domino Designer Wiki which I did go back to. There's some articles on Radio Buttons but they seem to be talking about a Control in the Other Controls section called a Radio Group. I still don't know what that is. Something to do with not having hard coded values but looking them up from a view I think. That didn't seem right so I moved on.
Back to playing with my XPage I noticed that even though I didn't really want this page bound to a Notes Form, it was telling me to. These radio buttons wanted to be bound to something. Ok who am I to argue with DDE? So I created a form and bound the 3 radio buttons in the group to the same field.
That's when something really interesting happened! I tried this code:
var choice1 = getComponent("radio1").getValue();
var choice2 = getComponent("radio2").getValue();
var choice3 = getComponent("radio3").getValue();
And guess what? Each variable contained the SAME value. So to get the Value of a radio button in XPages, just get the value of ANY of the controls in a Radio Group!
How cool is that? No looping to find a value like in normal JavaScript.
XPages are like wives. They can be frustrating at times, but at the end of the day, you're glad to be with them.
This is a long story for a relatively short answer. Sorry about that...
Recently I was working on a test XPage application and wanted to have a page that would let the users fill out some fields and then it would create a document in the "backend" using server side Javascript and send the document to a team HelpDesk e-mail account. I would not be saving this document in the application.
On this page I wanted to have a simple Radio button with the choices Low, Medium, and High. The user would choose the level of their problem and I'd include that in the e-mail. However, I hadn't used Radio Buttons up to that point. Especially in the case that I wasn't really saving the XPage. I only wanted to get the value to the backend document that would be mailed.
I had some problems trying to figure out how to get the value. You see, when you're dealing with individual radio buttons on an XPage, each option is it's own component and when you drop them on a page each has it's own unique name. This is not like the Notes Client where you have one Field of the type "Radio" with multiple options inside it. Hmmm.. I know in traditional Javascript you need to iterate through a control looking for the checked property. But what do you do here?
I first tried to get the value of the selected button by trying to do a getComponent on the group name.
var choice = getComponent("groupName")
Well that didn't get me to far. So I shouted out on twitter and got some good suggestions. The best might have been to ask Matt "Mr. XPages" White himself, but really this has to be solvable by us mere mortals. Paul Hannan noticed that I didn't have "getValue" at the end of my statement. Whoops. I do keep forgetting that so I gave this a try:
var choice - getComponent("groupName").getValue()
Still no Joy. Declan suggesting I look at the Domino Designer Wiki which I did go back to. There's some articles on Radio Buttons but they seem to be talking about a Control in the Other Controls section called a Radio Group. I still don't know what that is. Something to do with not having hard coded values but looking them up from a view I think. That didn't seem right so I moved on.
Back to playing with my XPage I noticed that even though I didn't really want this page bound to a Notes Form, it was telling me to. These radio buttons wanted to be bound to something. Ok who am I to argue with DDE? So I created a form and bound the 3 radio buttons in the group to the same field.
That's when something really interesting happened! I tried this code:
var choice1 = getComponent("radio1").getValue();
var choice2 = getComponent("radio2").getValue();
var choice3 = getComponent("radio3").getValue();
And guess what? Each variable contained the SAME value. So to get the Value of a radio button in XPages, just get the value of ANY of the controls in a Radio Group!
How cool is that? No looping to find a value like in normal JavaScript.
XPages are like wives. They can be frustrating at times, but at the end of the day, you're glad to be with them.
- 


Comments
Posted by Delcea Mihai At 04:57:19 AM On 11/06/2009 | - Website - |
Posted by martin At 03:21:26 AM On 05/19/2011 | - Website - |
Posted by Allan At 04:56:49 AM On 11/10/2010 | - Website - |
Posted by nexon game card online At 10:15:47 PM On 01/12/2011 | - Website - |
Posted by Stacey At 12:35:57 PM On 04/04/2011 | - Website - |
TIA
Posted by Lou Gerritse At 09:40:50 PM On 11/04/2009 | - Website - |
Posted by nike air max At 09:53:10 PM On 08/08/2011 | - Website - |
Posted by nike air max trainers At 10:46:32 PM On 04/17/2011 | - Website - |
Posted by itunes card code At 01:14:47 PM On 02/28/2011 | - Website - |
Posted by Havier At 04:18:50 AM On 11/22/2010 | - Website - |
Posted by Patrick Kwinten At 09:17:42 AM On 10/11/2010 | - Website - |
Posted by Иванов At 12:58:14 AM On 08/10/2010 | - Website - |
Posted by cheap nike air max At 12:30:46 AM On 09/22/2011 | - Website - |
Posted by cooltasche At 04:42:11 AM On 09/22/2011 | - Website - |
Posted by chanel At 04:43:27 AM On 09/22/2011 | - Website - |
I support you.
It’s really great article. I would like to appreciate your work and would like to tell to my friends.
{ Link }
Posted by Ray Ban Aviators At 01:14:01 AM On 09/29/2011 | - Website - |
Posted by chanel Ledertasche At 01:42:36 AM On 09/30/2011 | - Website - |
Posted by gift limit 2012 At 01:03:13 AM On 10/01/2011 | - Website - |
Posted by Burberry bowling bags At 10:36:39 PM On 10/08/2011 | - Website - |
With regards to shoe shopping, oftentimes I feel missing. Flat footed. Adrift in an ocean of heel heights and calf widths, not knowing exactly where to show. <h1><a href="{ Link } bailey button triplet</a><h1> is when I flip to my Chicago bestie, Luvvie <h1><a href="{ Link } bailey button triplet</a><h1>. You might currently know her as the humor blogger of AwesomelyLuvvie.com or the co-founder from the Red Pump Challenge; the creator of DumbestTweets.com or the web designer extraordinaire who produces internet sites such as the a single you will be studying appropriate now. Aside from undertaking and being all of those points, <h1><a href="{ Link } bailey button triplet</a><h1> can also be a thing of a shoe legend. When asked about this she responded, I don not know much bout science guides or geography, but I do know <h1><a href="{ Link } bailey button triplet</a><h1>. Hence her other blog for <h1><a href="{ Link } boots sale uk</a><h1>, How numerous sites can 1 person have? I believed I understood. And then I met <h1><a href="{ Link } for cheap</a><h1>.
Such as this post? Study the full story: 5 Awesomely Adorable & Affordable <h1><a href="{ Link } ugg boots</a><h1>
Wintertime is approaching, and when you live in a city like <h1><a href="{ Link } sheepskin cuff</a><h1>, it is essential that you are prepared for your <h1><a href="{ Link } sheepskin cuff</a><h1>. And not just prepared in <h1><a href="{ Link } boots sale uk</a><h1>. I also believe <h1><a href="{ Link } boots sale</a><h1> is really important to maintain some degree of adorable while getting warm. This is doable, even on a budget. Here are my top five picks of awesomely adorable AND affordable <h1><a href="{ Link } sheepskin cuff</a><h1>!
As most folks know <h1><a href="{ Link } on sale</a><h1>, <h1><a href="{ Link } north face</a><h1> is THE brand for cold weather accessories and apparel so they really do not disappoint in what they offer <h1><a href="{ Link } boots clearance</a><h1>. Put on a North Face jacket that is thick enough and see <h1><a href="{ Link } boots outlet</a><h1> if you do not sweat in the dead of winter for <h1><a href="{ Link } boots clearance</a><h1>. In a harsh winter like the one that is being predicted for us this year, this will come in handy.
These <h1><a href="{ Link } vuitton speedy</a><h1> are cute and add a spin for the common winter <h1><a href="{ Link } vuitton</a><h1> new collection with these black panels. Plus they're shiny in <h1><a href="{ Link } vuitton outlet</a><h1>. The inside with the boots have faux fur along with <h1><a href="{ Link } north face outlet</a><h1>'s PrimaLoft? Eco insulation. Your toes will be good and toasty in these. They may be $170, so they may be not undesirable price-wise. You are going to thank them if you can really feel your toes even in ten degree weather. Get them at <h1><a href="{ Link } boots clearance</a><h1>
Posted by uggs outlet At 04:23:15 AM On 10/15/2011 | - Website - |
In moderating, not satisfying, desires, lies peace.
Posted by Nike Shox At 11:58:44 PM On 10/18/2011 | - Website - |
In prosperity caution, in adversity patience.
Posted by Retro Jordans Shoes At 11:59:46 PM On 10/18/2011 | - Website - |
GOOD
Posted by Air Jordan 2011 At 09:23:36 PM On 10/19/2011 | - Website - |
Nike Air Jordan is one of the biggest and first,
Posted by Nike Air Max At 09:41:06 PM On 10/19/2011 | - Website - |
thanks
Posted by Cheap UGG Boots At 09:41:29 PM On 10/19/2011 | - Website - |
Posted by Craigslist Austin At 02:43:43 AM On 10/21/2011 | - Website - |
Posted by sending flowers to malaysia At 06:01:05 AM On 10/21/2011 | - Website - |
Posted by dell latitude d630 akku At 10:18:52 PM On 10/24/2011 | - Website - |
Posted by layered bob haircuts for 2012 ideea At 09:16:57 AM On 10/26/2011 | - Website - |
Posted by Craigslist Toronto At 06:01:51 AM On 11/01/2011 | - Website - |
Posted by software reviews At 11:21:24 PM On 11/01/2011 | - Website - |
Posted by nike air max 2011 At 11:03:21 PM On 11/02/2011 | - Website - |
Posted by UGG Boots 5825 At 06:45:34 AM On 11/14/2011 | - Website - |
Posted by Craigslist new york rentals At 02:19:41 AM On 11/15/2011 | - Website - |
Posted by Coach Outlet Online At 01:54:38 AM On 11/18/2011 | - Website - |
{ Link } Coach Factory Store
{ Link } Coach Outlet
{ Link } Coach Outlet
{ Link } Coach Outlet Online
{ Link } Coach Outlet
{ Link } Coach Outlet Online
{ Link } Chanel Outlet
{ Link } Chanel Outlet
{ Link } Louis Vuitton Outlet
{ Link } Coach Factory Store
{ Link } Chanel Handbags
{ Link } Coach Outlet
{ Link } Louis Vuitton
{ Link } LV Outlet
{ Link } Coach Outlet
{ Link } Coach Outlet
{ Link } Coach Outlet
{ Link } Chanel Bags
{ Link } Coach Outlet
Posted by Coach Outlet At 03:45:53 AM On 11/18/2011 | - Website - |
Posted by seo tips and tricks At 07:46:43 AM On 11/19/2011 | - Website - |
Posted by Nike Air Max At 02:25:27 AM On 11/24/2011 | - Website - |
Posted by Coach Factory Outlet Online At 09:44:25 PM On 12/02/2011 | - Website - |
Posted by deer antler velvet At 05:24:13 AM On 12/06/2011 | - Website - |
Posted by Coach Outlet Store Online At 08:40:10 PM On 12/06/2011 | - Website - |
Posted by Coach Factory Outlet At 10:13:48 PM On 12/06/2011 | - Website - |
Posted by Coach Factory Online At 06:38:50 AM On 12/08/2011 | - Website - |
Posted by Coach Factory Outlet At 12:59:25 AM On 12/12/2011 | - Website - |
{ Link }
{ Link }
{ Link }
{ Link }
{ Link }
{ Link }
{ Link }
{ Link }
{ Link }
Posted by Mulberry bags At 10:16:06 PM On 12/13/2011 | - Website - |
The [url={ Link } Vuitton handbags outlet[/url] are very hot now ,you can buy a lot of cheap louis vuitton bags from the [url={ Link } Vuitton Outlet[/url].Although they are only the website store, but they are sale and quality issurance ,you can pay for your favourite via a credit card, you will be fashion with the louis vuitton items especially to wear the [url={ Link } Vuitton Sunglasses[/url].
Posted by sdfds At 10:06:21 PM On 12/18/2011 | - Website - |
Posted by Coach Factory At 08:36:32 PM On 12/20/2011 | - Website - |
Posted by Corolla At 01:13:22 AM On 01/15/2012 | - Website - |
coach outlet online
store, the goods will be sent out within 24 hours after confirming your payment and arrive to your door within 7 work days.No one can deny the shopping at the
coach factory outlet
is satisfactory. For the low prices and good quality.
{ Link }
Posted by coach outlet online At 04:02:33 AM On 01/29/2012 | - Website - |
handbags You can not just save your cash but also your time inside a convenient way to obtain the exact same bags product and do not be concerned the shippment of one's products.The
coach outlet store online
are utilized for formal event in company area that will display your excellent taste.Not only does a briefcase make is easier to carry things.
{ Link }
Posted by coach outlet At 04:14:14 AM On 01/29/2012 | - Website - |
Posted by coach factory outlet At 07:45:09 PM On 01/29/2012 | - Website - |
Posted by louis vuitton uk At 07:49:02 PM On 01/29/2012 | - Website - |
coach outlet
.You will easily notice the unfold zippers of this
coach outlet store online
. That is the decoration. There are some inside pockets for you as well. They are easy to match your clothes and to carry.
Posted by coach outlet At 08:10:40 PM On 01/29/2012 | - Website - |
louis vuitton sale { Link }
everywhere.Looking for a
louis vuitton outlet { Link }
and don't know where they are? The easiest way is to enter here. That simple and you definitely will never be disappointed.
Posted by louis vuitton sale At 08:14:06 PM On 01/29/2012 | - Website - |
has a big heart and a healthy appetite, and a wicked swing with a chainsaw. After a knee injury ended his career as a defensive lineman in college, Coach salvaged his Physical Education degree(barely)and landed a job teaching health at the local high school in his hometown of Savannah.
coach factory online { Link }
are loved by many people, when you walk in the street, you could see many people take coach styles.
Posted by coach factory outlet At 08:20:40 PM On 01/29/2012 | - Website - |
{ Link }
Posted by coach outlet store At 09:32:01 PM On 01/29/2012 | - Website - |
{ Link }
Posted by coach outlet online At 09:34:59 PM On 01/29/2012 | - Website - |
coach outlet online
Store sells many series. The Coach shoulder bags are always the best popular series because they are very practical and beautiful.customers are not only interested in handbags and purses, but also fond of?shoes and jewelry which is sold at the
coach outlet
.
Posted by coach outlet online At 12:10:56 AM On 01/30/2012 | - Website - |
Posted by Bridal Lingerie At 04:06:02 AM On 02/02/2012 | - Website - |