Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

how to disable radio buttons or check box in SSI Web 7....getElementById dose not working

Can anyone plz tell me how to disable radio button or chekbox in SSI Web 7.
As in this new version grafical buttons are used so it seems quite difficult to find right id of button.

it is not done by  getElementById..

Please give me the solution.
asked Jan 11, 2012 by Gaurav (260 points)
edited Jan 11, 2012 by Walter Williams

1 Answer

0 votes
 
Best answer
you need to find and modify the div elements named graphical as well. For example for a "select" question named "TYPE", this is how you would hide the graphical checkbox
document.getElementById("TYPE_2_graphical").visibility = 'hidden';
document.getElementById("TYPE_2_graphical").disabled = 'true';
document.getElementById("TYPE_2_graphical").className = 'HideElement';


you need to do this for the label text as well.
answered Jan 11, 2012 by Bahadir Ozkurt Gold (16,830 points)
Mr.Bahadir Ozkur can u tell me on more ans plz:-
if i want that on clicking on first checkbox ,second checkbox would disable then what to do.
<script>

var ch = SSI_GetValue("TYPE_1");

if(ch==1)
{
document.getElementById("TYPE_2_graphical").disabled = 'true';
document.getElementById("TYPE_2_graphical").className ='checkbox';
document.getElementById("TYPE_2").disabled = 'true';
document.getElementById("TYPE_2_graphical").parentElement.parentElement.className = '';
}
</script>


the above script does not work. can u plz tell me the solution......
Your code will run once when the page loads and will not work, since TYPE_1 is not checked on page load. you need to assign an event listener to the first checkbox, so that when it is clicked your code above will run.

at the moment, I don't have time to try and get this one right, I suggest to search for "adding event listeners to checkboxes in javascript" or similar
Mr.Bahadir Ozkurt  this code is not running even at once.
plz find the solution......
Hi Gaurav,

I've come up with something to help you a little, but it does not work as I expected! Somehow the graphical checkboxes get clicked on page load (probably due to the used javascript library) and item 2 gets disabled without anyone clicking on item 1.


<script>
document.getElementById("TYPE_1_graphical").addEventListener('click', disabletwo() ,false);

function disabletwo ()
{
document.getElementById("TYPE_2_graphical").disabled = 'true';
document.getElementById("TYPE_2_graphical").className ='checkbox';
document.getElementById("TYPE_2").disabled = 'true';
document.getElementById("TYPE_2_graphical").parentElement.parentElement.className = '';
}
</script>


That's the best I can do given that I have work of my own to do as well :)
thanx for trying Mr. Bahadir Ozkurt ................but prob still remains..:)
...