How to setup the dynamic to

mm mmartin 25 Apr, 2012
Hi,

I used the chronoengine old version in a joomla 1.5 and works great, but I lost with this new version 4.0 in a joomla 1.5.26.

Well I setup a form with a drop down list that in his values have the first part of the e-mail. for example: martinemail


and I add a Hidden Field that will contain by php the rest of the code for the e-mail for example @gmail.com


so in the actions I add this controller

<?php
$loc = $_POST['input_select_1'];
if ( $loc ) {
  $_POST['input_hidden_10'] = $loc.'@gmail.com';
} 
?>


the result in the debbug is this.

Data Array: 
Array
(
    [option] => com_content
    [view] => article
    [id] => 22
    [Itemid] => 6
    [chronoform] => formulario2
    [event] => submit
    [input_select_1] => martinemail
    [input_text_2] => Martin
    [input_text_3] => 
 whofillstheform@gmail.com
    [input_text_4] => demo
    [input_text_5] => demo
    [input_text_6] => 777777
    [input_text_7] => demo
    [input_textarea_8] => demo demo
    [input_hidden_10] => 
    [input_submit_9] => Enviar
    [e24eee6867392087d3d7c6ee90702d75] => 1
)
Validation Errors: 
Array
(
)
Debug Data
email
10
Result
An email has been SENT successfully from (AdminWeb) info@myserver.com to martinemail
Body

Filds:
Destinatarios	 martinemail
Nombre	 Martin
Correo Electrónico	demodemo@gmail.com
Empresa	 demo
Cargo	 demo
Teléfono	 777777
Asunto	 demo
Mensaje	 demo demo

Submitted by 186.xxx.xxx.xxx
Attachments
array ( )


So I don't receive the e-mail to my [email]martinemail@gmail.com[/email] that's the problem. I see that the server send the e-mail from [email]info@myserver.com[/email] but the to just show martinemail I lost the rest @gmail.com

I try to put the e-mail complete in the drop list but the browser say that I Have to activate the javascript...

any support? or Idea to do this?

thanks for your time.

Hope you understand my english is not perfect..
Gr GreyHead 25 Apr, 2012
Hi mmartin ,

Pleas try replacing this code:
<?php
$loc = $_POST['input_select_1'];
if ( $loc ) {
  $_POST['input_hidden_10'] = $loc.'@gmail.com';
}
?>
with
<?php
$loc = $form->data['input_select_1'];
if ( $loc ) {
  $form->data['input_hidden_10'] = $loc.'@gmail.com';
}
?>

Bob



Bob
mm mmartin 25 Apr, 2012
Great!

Works fine! can you explain me why? I not PHP developer but just for understand your code.:-)

thanks for your great component! this is my 2 site with your chronoengine and this is just great!

saludos

M!
Gr GreyHead 28 Apr, 2012
Hi mmartin,

it's because ChronoForms loads the from data into the $from->data array when the form is first submitted and doesn't look at the $_POST array after that. So changes in $_POST have no effect.

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