Forums

form with choice of the recipient

sylvinho 13 Apr, 2010
I would like to know if it would be possible to create a form in which a drop-down list is which would make it possible to choose the recipient of the form

If it is the case, somebody could help me to create it.

Here what I would like to have:

- Name: (to enter your name, text)
- email: (to enter your email, text)
- Services: (to choose a service in a drop-down list, behind each service hiding place an address email which will make it possible to choose the recipient of the form
- Message: (to enter your message)

And a Button to send

Thank you for your assistance
GreyHead 13 Apr, 2010
Hi sylvinho,

The basic code for this is in FAQ #31 and there are many posts about it in the forums here.

Bob
sylvinho 13 Apr, 2010
OK but I always have a problem. I do not know how to configure the addresses emails in Forms Wizard.

I put my code HTML to you:
<div class="form_item">
  <div class="form_element cf_heading">
    <h2 class="cf_text">Formulaire de contact</h2>
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 150px;">Nom :</label>
    <input class="cf_inputbox required" maxlength="150" size="50" title="" id="text_2" name="text_2" type="text" />
  
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 150px;">E-mail :</label>
    <input class="cf_inputbox required" maxlength="150" size="50" title="" id="text_3" name="text_3" type="text" />
  
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 150px;">Services :</label>
    <select class="cf_inputbox validate-selection" id="select_4" size="1" title=""  name="select_4">
    <option value="">Choisissez le service que vous voulez contacter</option>
      <option value="em1">Arbitrage</option>
<option value="em2">Foot : compétitions, championnats</option>
<option value="em3">Foot : disciplinaire, rapports</option>
<option value="em4">Foot : coupes seniors, young cup, matches amicaux, tournoi</option>
<option value="em5">Futsal : compétitions, championnats</option>

    </select>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textarea">
    <label class="cf_label" style="width: 150px;">Votre message :</label>
    <textarea class="cf_inputbox" rows="3" id="text_5" title="" cols="30" name="text_5"></textarea>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_captcha">
    <label class="cf_label" style="display: none;">captcha</label>
    <span>{imageverification}</span> 
    
    </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_button">
    <input value="Envoyer" name="button_7" type="submit" />
  </div>
  <div class="cfclear"> </div>
</div>


And the On Submit code-before :
<?php
$emails_2 = array('em1'=>'cpa.hainaut@footbel.com', 'em2'=>'cp.foot.hainaut@footbel.com', 'em3'=>'disciplinaire.hainaut@footbel.com', 'em4'=>'coupes.hainaut@footbel.com', 'em5'=>'cp.futsal.hainaut@footbel.com');
$MyForm =& CFChronoForm::getInstance('form_name_here');
$MyFormEmails =& CFEMails::getInstance($MyForm->formrow->id);
$MyFormEmails->setEmailData(1, 'to', $emails_2[$_POST['recipients']]);
?> 


Do you find errors?
What is this I must make?
What do I have to modify?

Thanks
GreyHead 13 Apr, 2010
Hi sylvinho,

You need your **form name** in this line where it says 'form_name_here'

$MyForm =& CFChronoForm::getInstance('form_name_here');

Bob
sylvinho 14 Apr, 2010
Hello

What do I have to make in Form Wizard “Choose emails settings”?

I do not know how to use it!
Which are handling has to carry out?

Which are the stages which I must still carry out?

Thank you
GreyHead 14 Apr, 2010
Hi sylvinho,

To choose that step in the Wizard just click the heading.

For info on Email Setup please check the Email Tutorial from the Emails link above.

Bob
pinobird 24 Apr, 2010
Hi,

I'm also having problems with this issue. I've put the codes in the proper places. Now i have to set up the mails. I don't get it figured out where to place the proper setting for the selected mailaddress.

is it possible to do so in the wizard? If so please give a hint.

Thanks!!!

Hans
GreyHead 25 Apr, 2010
Hi Hans,

You need to have a Dynamic To element in your Email setup and put the input name into that box (without quote or brackets). Yes you can do this in the Wizard I think.

Bob
pinobird 25 Apr, 2010
Bob,

Thanks for your reply. Where can i find the input name?

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