I’m populating a select
field called ‘effectivedate’ dynamically with dates, where the text
format is formatted as ‘March 1, 2021’, and the value
formatting is ‘03/01/2021’. This is working fine. Here’s the snippet of my code:
foreach ($form['fields'] as &$field) {
if ($field->inputName == 'effectivedate') {
$choices = [];
foreach ( $dates as $k => $date ) {
$choices[] = array( 'text' => $date, 'value' => $k );
}
$field->choices = $choices;
}
}
When I pass this data to the next page via URL parameter. I have it set up on the confirmation page as &effectivedate={When do you want your benefits to begin?:15}
, and when it adds the parameter to the URL, it shows up as: &effectivedate=March+1st%2C+2021
. Is there a way to indicate that I want to pass the parameter with the value
(03/01/2021) and not the text
, or do I need to get the parameter and reformat it?
PS, I also have radio buttons that are passing the text of the selected radio button instead of the value: &gender={Gender:5}
returns &gender=Female
instead of ‘F’ (which is the value set for this radio button). I’d prefer to not have to go through and reformat all parameters that do this, if possible.
Thanks!