Multistage Form Auto Switch States

Thank you I’ve managed to get the multistage form now to switch stages upon selection using the code below. I’ve used this multiple times for each new state.

import {local} from ‘wix-storage’ ;

$w.onReady( function () {
$w( “#radioGroup1” ).onChange(()=>{
let selectedIndex = $w( “#radioGroup1” ).selectedIndex
console.log(selectedIndex)
if (selectedIndex=== 0 ) {function1();}
if (selectedIndex=== 1 ) {function2();}
if (selectedIndex=== 2 ) {function3();}
});
});

function function1(){$w( ‘#statebox1’ ).changeState( “stateboxFormState4” )}
function function2(){$w( ‘#statebox1’ ).changeState( “stateboxFormState4” )}
function function3(){$w( ‘#statebox1’ ).changeState( “stateboxFormState4” )}