Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Form API: change value of radio button
pawlr
I need a way to change (set) the value of a radio button (not the index, but the value!) I know how to change the index of the option, but not the value of the <option> wihtin a <radio> button.. any help is appreciated.. thx-Paul
hbo.com
Find more posts tagged with
Comments
Adam Stoller
Not sure how to do that, but perhaps a different approach would work.
I'm assuming you are trying to change the value based on some other value in some other field - yes?
Perhaps instead of changing the value, you hide/show the set of radio buttons based on some other value in some other field? i.e. different "sets" of radio buttons.
Just a thought, in case nobody else comes up with a direct response ... (sorry, I don't have code for doing this, otherwise I'd have included it. It's just an idea)
--fish
(Interwoven Senior Technical Consultant)
Migrateduser
'First you need to register the event
IWEventRegistry.addItemHandler("/yourRadio", "onItemChange", onRadioChange);
//Than you need to write a function to treat the event.
funciton onRadioChange()
{
var new_radio_value = "some value code";
var new_radio_text = "Another option";
//instanciate the objects like this
var radio_item = IWDatacapture.getItem("/your_radio_item");
var radio_item_options = radio_item.getOptions();
var radio_item_SelectionIndex = radio_item.getValue();
// To GET the value and text you do this
var radio_value = radio_item_options[radio_item_SelectionIndex].value;
var radio_text = radio_item_options[radio_item_SelectionIndex].text;
//To SET the value and text you do this
radio_item_options[radio_item_SelectionIndex].value = new_radio_value;
radio_item_options[radio_item_SelectionIndex].text = new_radio_text;
//To add a new option
radio_item.addOption = new Option("text", "value", false, false);
}
/*
I hope this can help!
Good luck!
*/
Paulo Gouveia
Royal Caribbean and Celebrity Cruises
Information Tecnology