Have an idea?

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

how to make one radio button the default response

I have 3 radio buttons, display_choice, values 1, 2 and 3.
I want to make the first button (value=1) the default, so that when someone goes to the page it is shown as being clicked. I think this needs some simple javascript but I don't know how to do this.
I tried to put this in the free format question but it didn't work

<script>
<!--
   document.getElementById("display_choice").value = 1;
-->
</script>
asked Feb 9, 2012 by anonymous

1 Answer

0 votes
document.mainform["display_choice"][1].checked = true;
should handle if you are not using the graphical buttons/checkboxes. if you are then you should also add something like
document.getElementById("display_choice_graphical").className += ' selected';

I don't remember the CSS class name off the top of my head, I hope this is the correct one.
answered Feb 9, 2012 by Bahadir Ozkurt Gold (16,830 points)
ah the second line of code should probably have an index as well... display_choice_1_graphical or something like that, just check the web pages html source code and try to find the correct ID.
...