October 04, 2018, 03:13 PM
Krishna.edara [CLOSED] Radio button Onchange
Hi,
I`m trying to use radio button on change function through JavaScript, some how is not working, can any one help me on fixing this
//Begin function REPORT_LEVEL_RADIO_onchange
//function REPORT_LEVEL_RADIO_onchange(event) {
function REPORT_LEVEL_RADIO_onchange(ctrl) {
var REPORT_LEVEL_RADIO= document.getElementById("REPORT_LEVEL_RADIO");
var ctrl = REPORT_LEVEL_RADIO.value;
//var ctrl = eventObject.target ? eventObject.target : eventObject.srcElement;
// TODO: Add your event handler code here
//creating vars for all the groupbox.
var mid_group_box = document.getElementById("MID_GROUP_BOX");
var client_group_list_box = document.getElementById("CLIENT_GROUP_LIST_BOX");
var sector_list_box= document.getElementById("SECTOR_LIST_BOX");
var entity_group_box = document.getElementById("ENTITY_GROUP_BOX");
var channel_list_box = document.getElementById("CHANNEL_LIST_BOX");
var rdc_list_box = document.getElementById("RDC_LIST_BOX");
//hiding all groupboxes by default and only showing the ones that are necessary.
IbComposer_showHtmlElement("MID_GROUP_BOX", true);
IbComposer_showHtmlElement("CLIENT_GROUP_LIST_BOX", false);
IbComposer_showHtmlElement("SECTOR_LIST_BOX", false);
IbComposer_showHtmlElement("ENTITY_GROUP_BOX", false);
IbComposer_showHtmlElement("CHANNEL_LIST_BOX", false);
IbComposer_showHtmlElement("RDC_LIST_BOX", false);
//
IbComposer_showHtmlElement("CHANNEL_TXT", false);
IbComposer_showHtmlElement("SECTOR_TXT", false);
IbComposer_showHtmlElement("CLIENT_GROUP_TXT", false);
IbComposer_showHtmlElement("ENTITY_TXT", false);
IbComposer_showHtmlElement("RDC_TXT", false);
if (ctrl == "MID"){
//Show the appropriate elements
IbComposer_showHtmlElement("MID_GROUP_BOX", true);
//position the elements in the correct place
MID_GROUP_BOX.style.top = "440px";
MID_GROUP_BOX.style.left = "60px";
}else if (ctrl == "OPEN_DATE") {
//Show the appropriate elements
IbComposer_showHtmlElement("MID_GROUP_BOX", false);
IbComposer_showHtmlElement("CLIENT_GROUP_LIST_BOX", false);
IbComposer_showHtmlElement("SECTOR_LIST_BOX", false);
IbComposer_showHtmlElement("ENTITY_GROUP_BOX", false);
IbComposer_showHtmlElement("CHANNEL_LIST_BOX", false);
IbComposer_showHtmlElement("RDC_LIST_BOX", false);
IbComposer_showHtmlElement("CHANNEL_TXT", false);
IbComposer_showHtmlElement("SECTOR_TXT", false);
IbComposer_showHtmlElement("CLIENT_GROUP_TXT", false);
IbComposer_showHtmlElement("ENTITY_TXT", false);
IbComposer_showHtmlElement("RDC_TXT", false);
//position the elements in the correct place
} else if (ctrl == "CHANNEL") {
//Show the appropriate elements
IbComposer_showHtmlElement("MID_GROUP_BOX", false);
IbComposer_showHtmlElement("CLIENT_GROUP_LIST_BOX", false);
IbComposer_showHtmlElement("SECTOR_LIST_BOX", false);
IbComposer_showHtmlElement("ENTITY_GROUP_BOX", false);
IbComposer_showHtmlElement("CHANNEL_LIST_BOX", true);
IbComposer_showHtmlElement("RDC_LIST_BOX", false);
IbComposer_showHtmlElement("CHANNEL_TXT", true);
IbComposer_showHtmlElement("SECTOR_TXT", false);
IbComposer_showHtmlElement("CLIENT_GROUP_TXT", false);
IbComposer_showHtmlElement("ENTITY_TXT", false);
IbComposer_showHtmlElement("RDC_TXT", false);
//position the elements in the correct place
CHANNEL_LIST_BOX.style.top = "440px";
CHANNEL_LIST_BOX.style.left = "60px";
CHANNEL_TXT.style.top = "420px";
CHANNEL_TXT.style.left = "60px";
}else if (ctrl == "RDC") {
//Show the appropriate elements
IbComposer_showHtmlElement("MID_GROUP_BOX", false);
IbComposer_showHtmlElement("CLIENT_GROUP_LIST_BOX", false);
IbComposer_showHtmlElement("SECTOR_LIST_BOX", false);
IbComposer_showHtmlElement("ENTITY_GROUP_BOX", false);
IbComposer_showHtmlElement("CHANNEL_LIST_BOX", false);
IbComposer_showHtmlElement("RDC_LIST_BOX", true);
IbComposer_showHtmlElement("CHANNEL_TXT", false);
IbComposer_showHtmlElement("SECTOR_TXT", false);
IbComposer_showHtmlElement("CLIENT_GROUP_TXT", false);
IbComposer_showHtmlElement("ENTITY_TXT", false);
IbComposer_showHtmlElement("RDC_TXT", true);
//position the elements in the correct place
rdc_list_box.style.top = "440px";
rdc_list_box.style.left = "60px";
rdc_txt.style.top = "420px";
rdc_txt.style.left = "60px";
}else if (ctrl == "SECTOR") {
//Show the appropriate elements
IbComposer_showHtmlElement("MID_GROUP_BOX", false);
IbComposer_showHtmlElement("CLIENT_GROUP_LIST_BOX", false);
IbComposer_showHtmlElement("SECTOR_LIST_BOX", true);
IbComposer_showHtmlElement("ENTITY_GROUP_BOX", false);
IbComposer_showHtmlElement("CHANNEL_LIST_BOX", false);
IbComposer_showHtmlElement("RDC_LIST_BOX", false);
IbComposer_showHtmlElement("CHANNEL_TXT", false);
IbComposer_showHtmlElement("SECTOR_TXT", true);
IbComposer_showHtmlElement("CLIENT_GROUP_TXT", false);
IbComposer_showHtmlElement("ENTITY_TXT", false);
IbComposer_showHtmlElement("RDC_TXT", false);
//position the elements in the correct place
sector_list_box.style.top = "440px";
sector_list_box.style.left = "60px";
sector_txt.style.top = "420px";
sector_txt.style.left = "60px";
}else if (ctrl == "CLG_NUM") {
//Show the appropriate elements
IbComposer_showHtmlElement("MID_GROUP_BOX", false);
IbComposer_showHtmlElement("CLIENT_GROUP_LIST_BOX", true);
IbComposer_showHtmlElement("SECTOR_LIST_BOX", false);
IbComposer_showHtmlElement("ENTITY_GROUP_BOX", false);
IbComposer_showHtmlElement("CHANNEL_LIST_BOX", false);
IbComposer_showHtmlElement("RDC_LIST_BOX", false);
IbComposer_showHtmlElement("CHANNEL_TXT", false);
IbComposer_showHtmlElement("SECTOR_TXT", false);
IbComposer_showHtmlElement("CLIENT_GROUP_TXT", true);
IbComposer_showHtmlElement("ENTITY_TXT", false);
IbComposer_showHtmlElement("RDC_TXT", false);
//position the elements in the correct place
client_group_list_box.style.top = "440px";
client_group_list_box.style.left = "60px";
client_group_txt.style.top = "420px";
client_group_txt.style.left = "60px";
}else if (ctrl == "ENT_NUM") {
//Show the appropriate elements
IbComposer_showHtmlElement("MID_GROUP_BOX", false);
IbComposer_showHtmlElement("CLIENT_GROUP_LIST_BOX", false );
IbComposer_showHtmlElement("SECTOR_LIST_BOX", false);
IbComposer_showHtmlElement("ENTITY_GROUP_BOX", true);
IbComposer_showHtmlElement("CHANNEL_LIST_BOX", false);
IbComposer_showHtmlElement("RDC_LIST_BOX", false);
IbComposer_showHtmlElement("CHANNEL_TXT", false);
IbComposer_showHtmlElement("SECTOR_TXT", false);
IbComposer_showHtmlElement("CLIENT_GROUP_TXT", false);
IbComposer_showHtmlElement("ENTITY_TXT", true);
IbComposer_showHtmlElement("RDC_TXT", false);
//position the elements in the correct place
entity_group_box.style.top = "440px";
entity_group_box.style.left = "60px";
entity_group_txt.style.top = "420px";
entity_group_txt.style.left = "60px";
}
}
//End function REPORT_LEVEL_RADIO_onchange
Thanks,
Krishna
This message has been edited. Last edited by: FP Mod Chuck , October 11, 2018 02:24 PM October 04, 2018, 03:23 PM
Don Garland Do you know for sure that the control event firing?
You can check this by commenting all of that out and add
alert("IT WORKS"); within the event.
Run your page and change the radio button option to make sure you get the alert.
This message has been edited. Last edited by: Don Garland , October 04, 2018 04:11 PM October 04, 2018, 03:41 PM
MartinY Look at the properties of your radio.
Then expand the drop down beside its name and insure that all element (LABEL and INPUT tag) under your radio are named as below to be properly referenced in js :
- Label should be :
REPORT_LEVEL_RADIO_LABEL_0
REPORT_LEVEL_RADIO_LABEL_1
REPORT_LEVEL_RADIO_LABEL_2
...
- INPUT Unique Identifier should be :
REPORT_LEVEL_RADIO0
REPORT_LEVEL_RADIO1
REPORT_LEVEL_RADIO2
...
- INPUT Name should be as below for ALL input tag:
REPORT_LEVEL_RADIO
When you create control, the HTML Composer does not name the first occurrence of the radio/checkbox with the name that you gave; you need to rename it.
If you need to rename one, pay attention to properly name the Unique Identifier and the Name of each input element.
October 04, 2018, 04:12 PM
Krishna.edara Control event is not firing.
May be the Label issue, but I did not find drop down besides it name (I re named as REPORT_LEVEL_RADIO).
Thanks,
Krishna.
October 04, 2018, 06:38 PM
Doug Why not use the '
out of the box ' functionality associated with buttons?
October 05, 2018, 08:12 AM
MartinY quote:
but I did not find drop down besides it name
Click on your radio control.
Expend/Open Properties tab
At top of Properties tab you will see :
REPORT_LEVEL_RADIO <DIV> and a down arrow at far right.
This is the drop down button for that control and this is where you will see all included elements for that control : labels and inputs that are part of a "table" tag.
But if your control event is not firing, it's something else.
Is it properly associated at the properties events tab ?
Is it the proper event that is associated to the control (Click instead of Value Changed) ?