I'm attempting to understand how to create an array of VALUES to use in a Custom Code element for SELECT drop-downs, and I'm not a big coder so I'm in a bit over my head.
I'm using a number of SELECT drop-downs in this form and when a user makes their choice, the VALUE appears in the email notification, so the form works but the VALUES aren't really useful to the user. I'd like to replace the VALUES with custom text that is more descriptive. You can see an example of a drop-down here -
Instead of displaying the actual value from the from in the email, I'd rather show the text associated with the VALUE.
So if a user chooses the first OPTION, instead of having the VALUE "onehr" display in the email, I'd rather the text be used instead - ONE 1-Hour Class a Week, $62.00 a month.
Everything I've been researching on the forums talks about creating an array of values to use onSubmit in a custom code element.
I've come up with the following attempt, but I'm not sure where the values for the last line come from and what elements they should match-up with from my form - "class_type", "$classes" and "class" aren't fields in my existing form, so I'm a bit lost with the last line
I'm using a number of SELECT drop-downs in this form and when a user makes their choice, the VALUE appears in the email notification, so the form works but the VALUES aren't really useful to the user. I'd like to replace the VALUES with custom text that is more descriptive. You can see an example of a drop-down here -
<select name="program" id="program" validation="validate-one-required">
<option rel="none" value="" selected>PLEASE SELECT YOUR PROGRAM</option>
<option rel="onehr" value="oneclass" style="border-top:1px dashed #CCC; ">ONE 1-Hour Class a Week, $62.00 a month</option>
<option rel="twohr" value="twoclass">TWO 1-Hour Classes a Week, $120.00 a month</option>
<option rel="threehr" value="threeclass">THREE 1-Hour Classes a Week, $174.00 a month</option>
<option rel="fourhr" value="fourclass">FOUR 1-Hour Classes a Week, $216.00 a month</option>
<option rel="fivehr" value="fiveclass">FIVE 1-Hour Classes a Week, $270.00 a month</option>
<option rel="sixhr" value="sixclass">SIX 1-Hour Classes a Week, $324.00 a month</option>
</select>
Instead of displaying the actual value from the from in the email, I'd rather show the text associated with the VALUE.
So if a user chooses the first OPTION, instead of having the VALUE "onehr" display in the email, I'd rather the text be used instead - ONE 1-Hour Class a Week, $62.00 a month.
Everything I've been researching on the forums talks about creating an array of values to use onSubmit in a custom code element.
I've come up with the following attempt, but I'm not sure where the values for the last line come from and what elements they should match-up with from my form - "class_type", "$classes" and "class" aren't fields in my existing form, so I'm a bit lost with the last line
<?php
$classes_array = array (
'oneclass' => 'ONE 1-Hour Class a Week, $62.00 a month',
'twoclass' => 'TWO 1-Hour Classes a Week, $120.00 a month',
'threeclass' => 'THREE 1-Hour Classes a Week, $174.00 a month',
'fourclass' => 'FOUR 1-Hour Classes a Week, $216.00 a month',
'fiveclass' => 'FIVE 1-Hour Classes a Week, $270.00 a month',
'sixclass' => 'SIX 1-Hour Classes a Week, $324.00 a month'
;
$form->data['class_type'] = $classes[$form->data['class']];
?>