Fine Tuning of the email

Store dropdown display values instead of keys in ChronoForms.

Overview

The form stores the dropdown option keys (like EM1) in the database instead of the display values (like Monday).
Use a custom code action to map the submitted key to its corresponding display value before saving the data.

Answered
ma maehooge 26 Feb, 2014
Hi,

I have the following question.

I have a form with a dropdown menu. here is the code:
EM1 = Monday
EM2 = Tuesday
EM3 = Wednesday
....

When storing the data in the database it is stored as EM1. But I want that ChronoForms stored Monday in the database.

What would be an appropriate solution?

Thank you for your response.
Gr GreyHead 26 Feb, 2014
HI Maehooge,

Please see this FAQ for CFv4, I think it will also work with CFv5.
ma maehooge 26 Feb, 2014
Answer
<?php
$recipient = JRequest::getString('recipients', 'em1', 'post');
$db = array (
  'em1' => 'Maandag',
  'em2' => 'Dinsdag',
  'em3' => 'Woensdag',
  'em4' => 'Donderdag',
  'em5' => 'Vrijdag',
  'em6' => 'Zaterdag',
  'em7' => 'Zondag',
);
$form->data['recipients'] = $db[$recipient];
?>


Sollition🙂 thx
This topic is locked and no more replies can be posted.