How to make mail template with this?

vinny 19 Jun, 2009
Hi everyone!
Can anybody help with this, please?
It is hard to explain, but I'll try. :o How to make, so in mail template will be displayed variable (_age) that have been calculated in javascript in the form?

In form there are 3 radio buttons, and when you click, it assign "_age=XX". Then javascript process this form and change value of "_age". How can I put this calculated "_age" in mail template?

This is just a example of form that I need:
<div class="form_item">
  <div class="form_element cf_radiobutton">
    <label class="cf_label" style="width: 150px;">Click Me to Edit</label>
    <div class="float_left">
      <input value="radio 1" title="" class="radio" id="radio00" name="radio0" type="radio" onclick="_age=15"/>
      <label for="radio00" class="radio_label">radio 1</label>
      <br />
      
<input value="radio 2" title="" class="radio" id="radio01" name="radio0" type="radio" onclick="_age=20"/>
      <label for="radio01" class="radio_label">radio 2</label>
      <br />
      
<input value="radio 3" title="" class="radio" id="radio02" name="radio0" type="radio" onclick="_age=25"/>
      <label for="radio02" class="radio_label">radio 3</label>
      <br />...

...     <input onclick="calc(this.form)" value="Submit" name="button_2" type="submit" /> ...
...    
<script language="javascript">
var _age = 0;
function calc(frm)
{ 
sums = _age+10;
}</script>
GreyHead 19 Jun, 2009
Hi vinny,

Quick answer, create a hidden input in the form and set its value with the javascript when you calculate the age. Then it will be sumbitted along with the other form values.

Bob
vinny 22 Jun, 2009
Hi Bob,

Thanks for answer!
But could you give an example of this hidden input, please?
I've only started learning JavaScript language.😟
Max_admin 22 Jun, 2009
a hidden input html code:
<input type="hidden" name="somename" id="myid">


js code to set its value:

document.getElementById('myid').value = 'some value';


Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
vinny 22 Jun, 2009
Cool! It's works.😀
Thanks Max.
This topic is locked and no more replies can be posted.