Radio buttons: display Title instead of value on multi page

Display radio button titles instead of values on a multi-page form.

Overview

The issue occurs because the form code retrieves the stored value (like "City2") rather than the associated display title (like "Berlin").
Use a conditional statement to map each stored value to its corresponding title for display. In CF6, ensure you reference the form data using the correct variable.

Answered
ChronoForms v5
pa pat01 20 Feb, 2019
Hello

In a CF5 form I use following code to display the value of a field on a multi page form:

$form->data['city'];

Where fom field 'city' are radio buttons:

City1=London
City2=Berlin
City3=Paris


The code above displays the value of the selected radio button.
How can I display the Title instead of the value? So on the multi page for example "Berlin" ist displayed instead of "City2"?

Thanks a lot!

Patrick
he healyhatman 20 Feb, 2019
Answer
1 Likes
switch($form->data['city']) {
case "City1":
echo "London";
break;
case "City2":
..........
}
je jeannivev 26 Jul, 2019
Hello. is it working on the CV6 I tried to add switch with the code in the event submit but it is not owrking
Gr GreyHead 29 Jul, 2019
Hi jeannivev ,

I believe that CFv6 uses $this->data in place of $form->data - does that help?

Bob
This topic is locked and no more replies can be posted.