Hi Everybody
I have a radio button field in my form say course with 3 options as UG PG Diploma and also i have 3 combo box fields named UG PG Diploma i want to hide the combobox fields depending upon the input in radio button.
e.g. if the radio option is UG then other two combo fields should be hidden on web.
Pl tell any way to accomplish it and please put some code if possible
thanx in advance
sandy
Subject: Hiding fields depending upon the input in radio button on web
Hi Sandy,
You can do that with javascript. Use events as onchange and use css to show/hide elements. There should be plenty example code on the internet to get you started. I’m not going to write it for you.
Joost
Subject: RE: Hiding fields depending upon the input in radio button on web
Hi JoostThanx for ur reply
If u can pl tell me any url where i will be able to find the examples of the same
thanx alot
Sandy
Subject: Hiding fields depending upon the input in radio button on web
I assume this is for a web app? Try something like this in the onclick event of the radio button field:
//grab a handle to the current form and the radio button field
var frm = document.forms[0];
var radioField = frm.Course;
//hide all the combo boxes
frm.UG.style.display = “none”;
frm.PG.style.display = “none”;
frm.Diploma.style.display = “none”;
//loop through the radio button to see which course is selected
for(var i = 0 ; i < radioField.length ; i++){
if(radioField[i].checked){
//according to the selected radio button, unhide the corresponding combo box
if(radioField[i].value==“UG”){
frm.UG.style.display = “”;
}else if(radioField[i].value==“PG”){
frm.PG.style.display = “”;
}else if(radioField[i].value==“Diploma”){
frm.Diploma.style.display = “”;
}
}
}
Subject: RE: Hiding fields depending upon the input in radio button on web
thanks jasonSandy