Form help - radio button selection | answer reverts to default


(Innes Zenati) #1

Matrix Version:6.45.1

I have a web form which has multiple journeys and a multiple choice radio button question which surfaces two different drop-down menus. If the user selects the wrong radio button and makes a selection but realises this is the wrong one, they select the other radio button and make a selection on the alternate drop-down menu. But, when this happens the previous answered is hidden on the previous drop-down and is printed in the email submission.

How do I revert their previous selection back to default when they hit the radio button?

I did consider simple validation rules but this wouldn’t be great accessibility wise for the user having to manually revert their old answer back to default. Would JS sort something like this?

The form is question is Expedite request and the question is the require evidence / not require evidence.

Thanks
Innes


#2

This should get you started. You could probably use conditionals in the email format, but this is easier.

var q4 = document.querySelectorAll("input[type='radio'][name='q213791:q4']"),
    q1 = document.getElementById("q213791_q1"),
    q5 = document.getElementById("q213791_q5");

q4.forEach(r=>{r.addEventListener("change", e=>{q1.selectedIndex = 0; q5.selectedIndex = 0})});

(Innes Zenati) #3

Hi @bkelly, thanks very much for coming back to me with this. I will give this a try and see how we go. Thanks again, Innes


(Harinder Singh) #4

You can also refer this form as an example. I am using JS to clear the value when the selection change.