Forums

"linking" prices to values

Gonçalves 12 Jan, 2010
Hi there,

I started using ChronoForms, and i would like to know if someone can help me.

I would like to know how can i "link" prices to the values, so it can return to me a final price.

My form: http://www.ricardogoncalves.rgphoto.ptservidor.com/joomla/index.php?option=com_chronocontact&chronoformname=Booking
Ex: i would like to give "One Way" - 50€ + Passengers 1-4 - 20€ and Holiday Destination Faro - 10€, and in the end i could get the total price.

Example i would like to follow: http://www.bookalgarvetransfer.com/

Thank you.
GreyHead 13 Jan, 2010
Hi Gonçalves,

You can do this with JavaScript in the form; or using PHP in one of the OnSubmit boxes. The Algarve site does it with JavaScript mostly from a file called head.js.

Bob
Gonçalves 13 Jan, 2010
Thank you.

Can you please tell me what should i search, so i can find any example of what i need?
GreyHead 13 Jan, 2010
Hi Gonçalves,

The files on the Algarve site are a good place to start.

Bob
Gonçalves 15 Jan, 2010
I keep trying it out.

<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="1" title="" class="radio" id="radio00" name="var1" type="radio" />
      <label for="radio00" class="radio_label">radio 1</label>
      <br />

<input value="2" title="" class="radio" id="radio01" name="var2" type="radio" />
      <label for="radio01" class="radio_label">radio 2</label>
      <br />


    </div>

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

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 150px;">Click Me to Edit</label>
    <select class="cf_inputbox" id="select_1" size="1" title=""  name="var3">
    <option value="">Choose Option</option>
      <option value="3">option 1</option>
<option value="4">option 2</option>

    </select>

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

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


I've posted the following code in "On Submit code - before sending email:" box, but it gives me a blank page.

<?php

     // Put the POSTed numbers into variables
     $var1 = floatval($_POST['var1']);
     $var2 = floatval($_POST['var2']);
     $var3 = floatval($_POST['var3']);
     $total = $var1 + $var2 + $var3;
     print $total;
?>
GreyHead 15 Jan, 2010
Hi Gonçalves,

Do you have Send Emails enabled on the Form General tab - if not, then the OnSubmit Before box will not execute.

Bob
Gonçalves 15 Jan, 2010
Thank you very much,

I've enable it, it works now.
Finnaly! :wink:
This topic is locked and no more replies can be posted.