Hello, I need to do coding too, but haven't figured out yet.
The closest I get to something usable so far has been putting the actual PHP code into the EMAIL template (horrible, isn't it?).
What I need to do is take form input and compute the something to be sent by email and if possible also stored in the db.
My initial thought has been to create an additional form input for the result (to be put in an HIDDEN-type input) and then
modify it using real computation on submit (before email).
Questions:
1) Is this possible ?
2) Can you show an example of *reading* form data (I found the mosGetParam call in one of the tabs and it worked, but not sure it's guaranteed to always work)
3) Can you show an example of *writing* form data ? using mosSetParam in email template resulted in an internal server error...
Thanks in advance.
Hi strk,
Which version of Joomla are you using (the code is quite different between 1.0 and 1.5)?
and what calculation do you want to do?
Bob
Hi strk,
Leave the default value of the hidden fields empty value='' (though is doesn't make much difference).
Turn on DeBug in the General tab, submit the form and post the print out of the $_POST array here please.
Bob
_POST: Array ( [name] => kl [email] => xxxx [citta] => [telefono] => xxx [data_arrivo] => [settimane] => 10 [textarea] => [bambini_3] => 0 [bambini_12] => 0 [bambini_26] => 0 [adulti] => 0 [adulti_60] => 0 [igloo] => 0 [materassini] => 0 [tenda3] => 0 [tenda4] => 0 [Messaggio] => [chrono_verification] => xi8Qv [Submit] => INVIA [costo] => 0 )
Case 2: Use template
name: kl email: xxxxt citta: telefono: xxx data_arrivo: settimane: 10 textarea: bambini_3: 0 bambini_12: 0 bambini_26: 0 adulti: 0 adulti_60: 0 igloo: 0 materassini: 0 tenda3: 0 tenda4: 0 Messaggio: chrono_verification: xi8Qv Submit: INVIA costo: test E-mail: 'Yes' custom
Email sent
------------- So far it seems the onSubmit executed ('cost' became 'test' from the original '0'), but keep reading:
E-mail message
From: xxx
To: xxx
Subject: xxxx
Costo totale: 0
------------ Here, the 'Costo totale' value (0) is expanded from {costo}
Hi strk,
Do you have the calculation code in the OnSubmit Before box?
And Send Emails set to On in the General Tab?
Bob
Hi strk,
[sendfb][/sendfb]
Bob
Attached is the form backup, from a local installation of joomla 1.0.15
and ChronoForms V2.3.9 J1.0.
Hi strk,
Thanks - it's late here, I'll take a look first thing in the morning.
Bob
Hi strk,
My memory is going :-(
The OnSubmit Before is executed **after** the field values are inserted in the html message body - weird but true!
We've worked around this before by adding in a place holder to the email and substituting this in the onSubmit before code.
If you set the value of the hidden field to say '##@@##' you can do a string replace in the OnSubmit code to substitute the calculated value.
Bob
Patch for chronocontacts.php (just moving the pre e-mail code execution where it belongs):
251,256d250
< /**
< * Run the On-submit 'pre e-mail' code if there is any
< */
< if ( !empty($rows[0]->onsubmitcodeb4) ) {
< eval( "?>".$rows[0]->onsubmitcodeb4 );
< }
402a397,402
> /**
> * Run the On-submit 'pre e-mail' code if there is any
> */
> if ( !empty($rows[0]->onsubmitcodeb4) ) {
> eval( "?>".$rows[0]->onsubmitcodeb4 );
> }
Hi strk,
Feature - bug who knows :-)
Max is the coder and has control over the code & distribution. I don't change anything as there is a risk of the download copies here being out of sync with the master code and the licensed distros.
Bob
Hi,
at V3.0 for J1.5 the "onsubmit before" is executed BEFORE we generate the email🙂 unfortunately I quit any coding for V2.3.9 long time ago, they will stop supporting it at the Joomla official site very soon too! its time to upgrade!
Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Hi,
I've read the post and can you please show how to do this with joomla 1.5?
I'm a newbie with coding. What I want done is:
DROP DOWN BOX
choose game to play: lotto 6/49 (the value should be 22.50)
lotto 6/45 (the value should be 12.50)
lotto 6/42 (the value should be 12.50)
TEXT FIELD -
can i set the field
to xx-xx-xx-xx-xx-xx ?
1. 6 Digit combination: xx-xx-xx-xx-xx-xx (the value should be the same as what the player chose in the drop down box)
2. 6 Digit combination: xx-xx-xx-xx-xx-xx (the value should be the same as above and it should be added)
Submit --> After submitting what is the best option to show the result?
Can it be seen in the confirmation page plug-in?
Thanks. Hope you can help me here.
Hi pauwiks,
No need to use the Confirmation page plugin here!
I'm also not sure I could understand the problem so please some real numbers!
Cheers
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Hi Pauwiks,
All of this is possible and is fairly straight-forward. The questions you are asking are better answered from a good HTML tutorial; you'll find many on the web - those at W3Schools are pretty reliable. Or you may be better off getting a more knowledgeable friend to help you with the basic form coding.
Bob
Hi,
I went to w3schools and studied the HTML Forms, but the tutorials does not include what I want to be done. Also I don't have any programmer friends. I'm the only one in my group that knows how to do basic html.😀
I attached a .jpg file showing what I want to happen. How you can point me to the right direction. Thanks!
Pauwiks
Hi,
Please show me your form HTML code!
Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.