select recipients

belex24 22 Nov, 2011
Hi!

I read several postings here, did what they said, but it does not work.
here is my problem: in the form code I have

<select name="recipients" id="recipients">
<option value="em1">Peterhead</option>
<option value="em2">Kinlochbervie</option>
<option value="em3">Macduff</option>
</select>

Then I click on "wizard edit", there in the events-box I drag and drop a "custom code" action to the onSubmit section.
With "controller" active I pasted that php-code:

<?php
$recipient = JRequest::getString('recipients', '', 'post');
$emails = array (
'em1' => 'mail1@mail.at',
'em2' => 'mail2@mail.at',
'em3' => 'mail3@mail.at',
);
$email_to_use = $emails[$recipient];
JRequest::setVar('email_to_use', $email_to_use);
?>

In another actions field called "Email" I have
Dynamic To: email_to_use
and in the register Static every required field is filled out.

The E-Mail-box is UNDER the custom code box. When I activate debugger I get successfully sent to the e-mail-adress, which is under required static fields. but not those of the drop-down.

And what happens: the mail is sent, but NOT to the selected addresses.

Please view also the attached images .

and it's so annoying, couse everything worked fine in the former form I build years ago with chronoform, but now I need to rebuilt it and it does not work anymore😟(

sorry, but I really tried it for ages, read all posts, all faqs. but it does not work.

(and I am FAAAR away from my next issue: validating three fields, which didn't work either).

Any help is very appreciated,
thank you very much in advance!

[attachment=2]5.jpg[/attachment]
[attachment=1]8.jpg[/attachment]
[attachment=0]7.jpg[/attachment]
GreyHead 29 Nov, 2011
Hi belex24,

The code you are using comes from ChronoForms v3 and does not work with ChronoForms v4 :-(

Please change these lines
$email_to_use = $emails[$recipient];
JRequest::setVar('email_to_use', $email_to_use);
to
$email_to_use = $emails[$recipient];
$form->data['email_to_use'] = $email_to_use;

Bob
belex24 30 Nov, 2011
Thank you sooo much for your answer. But honestly: where could I find something like this in a documentation or in the FAQs? I spent 4 days with this before I asked in the forum. No I waited almost 2 weeks for your help. It's a very unusual way to work for me.
But again: thank you very much.
GreyHead 30 Nov, 2011
Hi belex24,

Ask Max - this is his product. I just help out in the forums here.

This answer is already posted here three or four times.

I'm sorry that there was a delay in replying to your post. Often it's quicker. It happened that I was away for a few days and came back to find over 60,000 spam posts here.

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