Radio button label as form POST variable


(Mitch Kerry) #1

Hey all

I’m trying to set a session var in a trigger based on a form submission but am wondering how I can access the label of a radio button rather than the value. Similarly for checkboxes.

At the moment I have %globals_post_qXXXX:qXX% which only returns the value of the radio (e.g. 0,1,2) but I want the associated label.

Is there syntax for this or would I need to set the value via JS in the form?

update
On that, I tried to set all radios to have the label as the value and the form would not submit.

thanks
Mitch


(Bart Banda) #2

There’s no trivial way to do it I don’t think. “Simplest” way would be to replicate the possible labels into an array and then use the response as the key to find the position in the array to extract the value from, using SSJS of course.


(Mitch Kerry) #3

Thanks @Bart.
What I might do is dump the values into hidden text fields then use those instead.