Forums

Dynamic dropdown result second field in email

Astrid 29 Oct, 2013
Managed to create a dynamic dropdown.
First dropdown consist of days of the week. Second dropdown consists of available times on that day.
Example dynamic dropdown:
monday: 1= between 13.00 and 15.00,2=between 15.00 and 17.00

And so on for every day of the week.
Added in On Submit:
Show Thanks message
Custom code:
<?php
$tijd_array = array(
  1 => 'between 13.00 and 15.00',
  2 => 'between 15.00 and 17.00',
  3 => 'between 10.00 and 12.00',
  4 => 'between 12.00 and 14.00',
  5 => 'between 14.00 and 16.00',
  6 => 'tbetween 16.00 and 18.00',
  7 => 'between 18.00 and 21.00',
  8 => 'between 10.00 and 12.00'
);
$form->data['tijd_name'] = $tijd_array[$form->data['tijd']];
?>

Handle arrays
Email:
Related code in email:
<tr>
<td><strong> en tijd</strong></td>
<td>{tijd_name}</td>
</tr>

Result in email is still corresponding number instead of text.
I am definitely missing something, but can't figure out what it is.
GreyHead 30 Oct, 2013
Hi Astrid,

Is the Custom Code action **before** the Email action?

Please drag a Debugger action into the On Submit event, then submit the form and post the debug - including the 'dummy emails' results here.

Bob
Astrid 30 Oct, 2013
Hi Bob,
Thanx for your reply!

Hi Bob,
Thanx!
Event order is exactly like in my question, so yes, Custom code is before email action.
First field is [dag] en second field should be [tijd_name] I suppose. But debug returns [tijd] which is the name of the field with id 2 that is used in dynamic dropdown. Changed that to [tijd_name] to test, but debug still keeps showing a field [tijd].

Anonymised some data and changed others into English but these are the debug results:

Array
(
    [chronoform] => afspraak
    [event] => submit
    [voornaam] => Astrid
    [tussen] => secondname
    [achternaam] => lastname
    [geslacht] => Female
    [telefoon] => 0000000000
    [email] => astrid@email.com
    [geboortedag] => 1
    [geboortemaand] => januari
    [geboortejaar] => 2000
    [dag] => woensdag
    [tijd] => 3
    [soort_afspraak] => appointment
    [bril] => No
    [contactlenzen] => No
    [belmij] => No
    [mailmij] => Yes
    [opmerking] => Remarks from me
    [versturen] => Send
    [6e3642a1cd59d3f84619949e2bd0dda3] => 1
)

Validation Errors:

Array
(
)
GreyHead 30 Oct, 2013
Hi Astrid,

Hmmmm . . . the code looks OK and I can see tijd in the debugger output - but I don't see tijd_name at all.

By all means email or PM me the site URL, the form name, and a SuperAdmin login and I'll take a quick look.

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