Problem after updating

stan86 14 May, 2009
Hello,

My form doesn't work appropiately after updating chronoforms to RC 5.
I have got a form where people can select a contactperson through a dropdownbox. In the emailformat, all the emailadresses are put in the 'to field'. A php script in the onSUbmit before box defines which mail adres have to be used, according to the choice of the dropdownbox.

AFter updating in fact, the mail is sent to all the mail adresses in the to field in the email format.

Can someone help me please? Thank you

Form code:

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label">Aan:</label>
    <select class="cf_inputbox validate-selection" id="select_2" size="1" {cf_multiple} name="aan">
    <option value="">Kies</option>
      <option value="groepssecretaris">Groepssecretaris</option>

 <option value="webmaster">Webmaster</option>

 <option value="penningmeester">Financiële administratie</option>

 <option value="contactpersoon ScAm">ScAm redactie</option>

 <option value="teamleider Bevers">Teamleider Bevers</option>

 <option value="teamleider Kabouters">Teamleider Kabouters</option>

 <option value="teamleider Welpen">Teamleider Welpen</option>

 <option value="teamleider Gidsen">Teamleider Gidsen</option>

 <option value="teamleider Verkenners">Teamleider Verkenners</option>

 <option value="teamleider Sheros">Teamleider Shero's</option>

 <option value="secretaris Pivos">Secretaris Pivo's</option>

 <option value="contactpersoon Stam">Contactpersoon Stam</option>


    </select>
<a class="tooltiplink" onclick="return false;"><img height="16" border="0" width="16" class="tooltipimg" src="components/com_chronocontact/css/images/tooltip.png"/></a>
				<div class="tooltipdiv">Aan: :: Kies hier aan wie u uw vraag of opmerking wilt adresseren. Kies voor algemeen groepssecretaris!</div>
    </div>
  <div class="clear"> </div>
    
  </div>
  <div class="clear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_radiobutton">
    <label class="cf_label">Heeft u een kind bij Scouting Amby?</label>
    <div class="float_left">
      <input value="één of meerdere " class="radio radio validate-one-required" id="radio_1
" name="radio0" type="radio" />
      <label for="radio_1
" class="radio_label">Ja
</label>      

<input value="geen 
" class="radio radio validate-one-required" id="radio_1
" name="radio0" type="radio" />
      <label for="radio_1
" class="radio_label">Nee
</label>
      <br />
      

    </div>
    
  </div>
  <div class="clear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label">Naam:</label>
    <input class="cf_inputbox required" maxlength="150" size="30" id="text_7" name="naam" type="text" />
  
  </div>
  <div class="clear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label">Telefoon nummer:</label>
    <input class="cf_inputbox validate-number" maxlength="150" size="30" id="text_8" name="telefoon" type="text" />
  
  </div>
  <div class="clear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label">Email adres:</label>
    <input class="cf_inputbox required validate-email" maxlength="150" size="30" id="text_6" name="email" type="text" />
  
  </div>
  <div class="clear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label">Onderwerp:</label>
    <input class="cf_inputbox required" maxlength="150" size="30" id="text_5" name="onderwerp" type="text" />
  
  </div>
  <div class="clear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textarea">
    <label class="cf_label">Opmerking / vraag:</label>
    <textarea class="cf_inputbox required" rows="10" id="text_9" cols="30" name="vraag"></textarea>
    
  </div>
  <div class="clear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_captcha">
    <label class="cf_label">Controle:</label>
    <span>{imageverification}</span> 
    <a class="tooltiplink" onclick="return false;"><img height="16" border="0" width="16" class="tooltipimg" src="components/com_chronocontact/css/images/tooltip.png"/></a>
				<div class="tooltipdiv">Controle: :: Neem de vetgedrukte letters over ter controle (Anti SPAM) HOOFDLETTER GEVOELIG</div>
    </div>
  <div class="clear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_button">
    <input value="Verzenden" type="submit" />
  </div>
  <div class="clear"> </div>
</div>


Onsubmit before box:

<?php
if(JRequest::getVar('aan') == "groepssecretaris")$emails[0]->to = 'info@scoutingamby.nl';
if(JRequest::getVar('aan') == "webmaster")$emails[0]->to = 'webmaster@scoutingamby.nl';
if(JRequest::getVar('aan') == "penningmeester")$emails[0]->to = 'info@scoutingamby.nl';
if(JRequest::getVar('aan') == "contactpersoon ScAm")$emails[0]->to = 'scam@scoutingamby.nl';
if(JRequest::getVar('aan') == "teamleider Bevers")$emails[0]->to = 'bevers@scoutingamby.nl';
if(JRequest::getVar('aan') == "teamleider Kabouters")$emails[0]->to = 'kabouters@scoutingamby.nl';
if(JRequest::getVar('aan') == "teamleider Welpen")$emails[0]->to = 'welpen@scoutingamby.nl';
if(JRequest::getVar('aan') == "teamleider Gidsen")$emails[0]->to = 'gidsen@scoutingamby.nl';
if(JRequest::getVar('aan') == "teamleider Verkenners")$emails[0]->to = 'verkenners@scoutingamby.nl';
if(JRequest::getVar('aan') == "teamleider Sheros")$emails[0]->to = 'sheros@scoutingamby.nl';
if(JRequest::getVar('aan') == "secretaris Pivos")$emails[0]->to = 'pivos@scoutingamby.nl';
if(JRequest::getVar('aan') == "contactpersoon Stam")$emails[0]->to = 'stam@scoutingamby.nl';
?>
Max_admin 14 May, 2009
Hi Stan,

Thats because of the core changes happened!

Add these 2 lines after the <?php line:

$MyForm =& CFChronoForm::getInstance('your_form_name_here');
$MyFormEmails =& CFEMails::getInstance($MyForm->formrow->id);

then replace all the
$emails[0]->to = 'info@scoutingamby.nl';
by this new formula:


$MyFormEmails->setEmailData(1, 'to', $MyFormEmails->getEmailData(1, 'to').',info@scoutingamby.nl');


you will change the email at each line of course!

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
stan86 14 May, 2009
First of all, thanks for your help! And that fast!

But is still doesn't work with the new code you gave me..

<?php 

$MyForm =& CFChronoForm::getInstance('kontak');
$MyFormEmails =& CFEMails::getInstance($MyForm->formrow->id);


if(JRequest::getVar('aan') == "groepssecretaris")$MyFormEmails->setEmailData(1, 'to', $MyFormEmails->getEmailData(1, 'to').',info@scoutingamby.nl');

if(JRequest::getVar('aan') == "webmaster")$MyFormEmails->setEmailData(1, 'to', $MyFormEmails->getEmailData(1, 'to').',webmaster@scoutingamby.nl');

if(JRequest::getVar('aan') == "penningmeester")$MyFormEmails->setEmailData(1, 'to', $MyFormEmails->getEmailData(1, 'to').',info@scoutingamby.nl');

if(JRequest::getVar('aan') == "contactpersoon ScAm")$MyFormEmails->setEmailData(1, 'to', $MyFormEmails->getEmailData(1, 'to').',scam@scoutingamby.nl');

if(JRequest::getVar('aan') == "teamleider Bevers")$MyFormEmails->setEmailData(1, 'to', $MyFormEmails->getEmailData(1, 'to').',bevers@scoutingamby.nl');


if(JRequest::getVar('aan') == "teamleider Kabouters")$MyFormEmails->setEmailData(1, 'to', $MyFormEmails->getEmailData(1, 'to').',kabouters@scoutingamby.nl');

if(JRequest::getVar('aan') == "teamleider Welpen")$MyFormEmails->setEmailData(1, 'to', $MyFormEmails->getEmailData(1, 'to').',welpen@scoutingamby.nl');

if(JRequest::getVar('aan') == "teamleider Gidsen")$MyFormEmails->setEmailData(1, 'to', $MyFormEmails->getEmailData(1, 'to').',gidsen@scoutingamby.nl');

if(JRequest::getVar('aan') == "teamleider Verkenners")$MyFormEmails->setEmailData(1, 'to', $MyFormEmails->getEmailData(1, 'to').',verkenners@scoutingamby.nl');

if(JRequest::getVar('aan') == "teamleider Sheros")$MyFormEmails->setEmailData(1, 'to', $MyFormEmails->getEmailData(1, 'to').',sheros@scoutingamby.nl');


if(JRequest::getVar('aan') == "secretaris Pivos")$MyFormEmails->setEmailData(1, 'to', $MyFormEmails->getEmailData(1, 'to').',pivos@scoutingamby.nl');

if(JRequest::getVar('aan') == "contactpersoon Stam")$MyFormEmails->setEmailData(1, 'to', $MyFormEmails->getEmailData(1, 'to').',stam@scoutingamby.nl'); ?>


Do I overloook something?

Stan
Max_admin 14 May, 2009
Hi Stan,

Do you have anything in the To field for this email ? you need an email setup and enabled with a "To field" which has some valid email address!

Cheers
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
stan86 14 May, 2009
Yes, in the to field all email adresses are filled in which are also in the php script. The email set up has a to, subject, fromname, and frommail field and its also enabled...
Max_admin 15 May, 2009
ok, at the end of the code please add this:
echo     $MyFormEmails->getEmailData(1, 'to');


let me know what you see after the email is submitted, and make sure we use the code in the onsubmit before email box!

Cheers
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
stan86 15 May, 2009
Hello Max,

The code is in the Onsubmitbefore box. When adding the little code I got the following:

[email]info@scoutingamby.nl[/email], [email]webmaster@scoutingamby.nl[/email], [email]scam@scoutingamby.nl[/email], [email]bevers@scoutingamby.nl[/email], [email]kabouters@scoutingamby.nl[/email], [email]welpen@scoutingamby.nl[/email],gidsen@scoutingamby.nl, [email]verkenners@scoutingamby.nl[/email], [email]sheros@scoutingamby.nl[/email], [email]pivos@scoutingamby.nl[/email], [email]stam@scoutingamby.nl[/email],webmaster@scoutingamby.nl

I selected webmaster in the dropdownbox (corresponding email: [email]webmaster@scoutingamby.nl[/email]), and you see that email adress is selected twice.

Stan
stan86 15 May, 2009
Hello,

My problem is solved! The solution is to let the to field in de mailformat empty.

Thanks for your assistence! Is every chronoform update by the way subject to these core changes?

Stan
GreyHead 16 May, 2009
Hi Stan,

Is every chronoform update by the way subject to these core changes?

In general No. What's happened in recent releases is that Max has been going through a pretty much complete rebuild of the core code of ChronoForms, using classes to put the code into distict 'building block' classes that make it much easier to mix and matche the options and to get ChronoForms working reliably in the PlugIns and Module modes.

The latest releases of ChronoForms are much more sophisticated than the releases of even six months ago and are capable of much more flexible applications. But accommodating those does require some changes.

I think that most of the front'end work is now complete but there may still be a few more changes. And there will be more in the back-end but that affects users much less.

Bob
Max_admin 18 May, 2009
Hi Stan,

Thanks for posting the solution, but for other users, could you please clarify this line ? I can't understand it!🙂

The solution is to let the to field in de mailformat empty. 


Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
stan86 18 May, 2009
in the tab 'setup emails', you can see the emailcontainers of a form. You'll add a 'to field' but in fact you'll fill in any email adresses in this 'to field'. Is this clear?
Max_admin 19 May, 2009
I think its now, thank you!🙂

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.