Forums

Multi page, counter and on submit code

tubbergen 21 Feb, 2011
I'm almost done with the making of a multi page form, with an on submit code. There is just one thing that doesn't work and that is adding up 2 fields.

The form is for ordering a bouquet of flowers at a flowershop. The customer can select a type and so on. They also can select if they would like it to be delivered (at some cost). The total cost (bouquet and delivery) and description need to be send to a different component which handles the payment.

The total cost needs to be added up and that's a problem for me. I tried a bunch of things, but I can't seem to find a solution. I now have this code for sending 2 fields, and it works:


<?php
    $MyForm->formrow->redirecturl .= 'betalen.html?bedrag='.JRequest::getFloat('radio1', 0, 'POST').'&omschrijving='.JRequest::getString('radio0', 0, 'POST').', '.JRequest::getString('select_0', 0, 'POST');
?>


How can I add up 2 fields, using a multi page form with an on submit code? I use v3.2 (validated of course) at http://www.hulshof-bloemsierkunst.nl/bestellen.html
GreyHead 21 Feb, 2011
Hi tubbergen,

First a general comment - it's much easier to work with forms like this if you edit the input names and ids to be more meaningful - i.e. replace name='radio0' id='radio01' with name='bedrag' id=bedrag1'.

With the select_1 drop-down I'd also be inclined to use simple values and add a look up array for the prices; parsing a value like "Gemeente Tubbergen (+ €5,- bezorgkosten)" to extract the correct price is never going to be highly reliable.

All that said, in this case as the two prices are on the same form step I'd use a small JavaScript snippet to add them together in the browser and add the result to a hidden input - and probably also display it to the customer.

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