Getting value of a specific field (email) to pass to detail page for a contact form
Permalink Browser Info Environment
Hi
I've been trying to come up with a solution to this for a while and wondered if anyone else has done anything similar
I have a list of employees that is created with Advanced Forms, and they each have an email address field associated with them. What I want to do, is when the Details link is clicked on one of the employees in the list, the user is then taken to another page with a contact form for that employee. In other words, the contact form on this page will send the contact form notification to an email address that is decided dynamically by the employee that was clicked on in the list, and takes the email address from there.
I have this modified code so far in blocks/form/controller.php:
$mh = Loader::helper('mail');
$sendtoemail = $emailaddressfromlist;
$page = Page::getCurrentPage();
$pageParent = Page::getByID($page->getCollectionParentID());
if ($pageParent->getCollectionName() == "Employee List") {
$mh->to( $sendtoemail );
}
else {
$mh->to( $this->recipientEmail );
}
What I can't work out is how to go about getting the email address from the employee list on the list page and pass that value to $emailaddressfromlist once on the detail page
Anyone have any ideas?
Much appreciated!
I've been trying to come up with a solution to this for a while and wondered if anyone else has done anything similar
I have a list of employees that is created with Advanced Forms, and they each have an email address field associated with them. What I want to do, is when the Details link is clicked on one of the employees in the list, the user is then taken to another page with a contact form for that employee. In other words, the contact form on this page will send the contact form notification to an email address that is decided dynamically by the employee that was clicked on in the list, and takes the email address from there.
I have this modified code so far in blocks/form/controller.php:
$mh = Loader::helper('mail');
$sendtoemail = $emailaddressfromlist;
$page = Page::getCurrentPage();
$pageParent = Page::getByID($page->getCollectionParentID());
if ($pageParent->getCollectionName() == "Employee List") {
$mh->to( $sendtoemail );
}
else {
$mh->to( $this->recipientEmail );
}
What I can't work out is how to go about getting the email address from the employee list on the list page and pass that value to $emailaddressfromlist once on the detail page
Anyone have any ideas?
Much appreciated!
Type: | Discussion |
---|---|
Status: | New |