core icon indicating copy to clipboard operation
core copied to clipboard

Return Lookup Value not Foreign Key Value

Open jweese74 opened this issue 4 years ago • 0 comments

One thing I have been struggling with, that would be wonderful to have a solution for many of my forms: Unfortunately, I've been unable to produce one, but I suspect it involves the Submission Pre-Parser module:

I have a table that contains my user information, various forms of information from First Name, Last Name, Contact Numbers, and Email Addresses.

I reference this table in many of my forms using either a drop-down selection or a radio button. More specifically, I reference the "Email" field in this table.

When I try to send an email to this address, however, it attempts to send the email to the foreign key identifier of the table, not the email address selected from the table.

My knowledge of PHP is limited unfortunately so I've hit a roadblock. I suspect I'll have to use the Submission Pre-Parser module and some sort of array associated with the foreign key and email address, then write the email address into another field. But, after many attempts and a couple of days spent - I've come here for the answer.

//Lets make the key passed from Form Tool a bit easier to understand
$KeyEmail = $_POST["employee_email"];

//Define Email Addresses
$EmlArray = array("","[email protected]","[email protected]","[email protected]","[email protected]","[email protected]");

if ($_POST["form_tools_calling_function"] == "ft_update_submission") {

    $_POST["true_email"] = $EmlArray[$KeyMail];

}

I've got this calling from a rule created in the pre-parser.

jweese74 avatar Aug 12 '21 18:08 jweese74