Forums

Display Cost and Submit form without redirect

dirtystreetads 24 Jan, 2009
Hello All,

I'm having trouble doing some multiple onClick/onSubmit functions. I'm not a javascript programmer and have a hard time getting my head around it, but...

I've created a quote form where a user enters some numbers, the form calculates the numbers in a specified way and outputs it to a field onscreen. This part is fine, the problem i'm having is when it comes to submitting the users details and quote information to me via email.

if i put a submit() function in,the form redirects to another page and nothing gets sent accross. I've tried everything i know how to do, and was wondering if anyone could be of some help here?

I would really appreciate any help supplied, please also bear in mind i'm not a programmer, but i've got so far i dont want to give up.

The form can be located at: http://www.dirtystreetads.com/quote.html
Here's my code for my form....
<h2>Online Quote</h2>			

	<form onclick="KW_calcForm('Total Cost',100,2,'#NumberOfStencilsHidden','+','#DistanceFromBristolHidden','+','#NumberOfLocationsHidden','+','#ConsultationNeededHidden','+','150')">
    <table width="100%" border="0" cellpadding="5">
<tr>
<td colspan="2">Please feel free to use the form below to generate an instant online quote. Prices are subject to change, and prices may vary slightly depending on the size and design of your logo, whether your design meets our requirements and any other special factors you may have for your campaign.<br><BR>Don't forget we also do a <b>110% Price-Beat Guarentee</b>, so if you find a business that quotes you less than us, we'll match the price and offer you 10% cash-back!<br><BR>
Please make sure you <A HREF="mailto:info@dirtystreetads.com?Subject=Full%20Quote%20Request">Contact Us</A> to receive a full quote after you have received your instant quote.<br><br>
      <tr>
        <th scope="row"><div align="left" class="style1">Your Full Name</div></th>
        <td><span class="style1">
        <input type="text" maxlength="100" size="25" name="name" />
        </span></td>
      </tr><tr>
        <th scope="row"><div align="left" class="style1">Your E-mail</div></th>
        <td><span class="style1">
        <input type="text" maxlength="100" size="25" name="email" />
        </span></td>
      </tr><tr>
        <th scope="row"><div align="left" class="style1">Contact Telephone Number</div></th>
        <td><span class="style1">
        <input type="text" maxlength="25" size="25" name="telno" />
        <input type="hidden" value="" name="telno" />
        </span></td>
      </tr><tr>
        <th scope="row"><div align="left" class="style1">Number of Stencils        </div></th>
        <td><span class="style1">
        <input type="text" maxlength="20" size="25" onblur="KW_calcForm('NumberOfStencilsHidden',100,2,'#NumberOfStencils','*','25')" name="NumberOfStencils" />
        <input type="hidden" value="" name="NumberOfStencilsHidden" />
        </span></td>
      </tr>
      <tr>
        <th scope="row"><div align="left" class="style1">Distance From Bristol (Miles) </div></th>
        <td><span class="style1">
        <input type="text" maxlength="20" size="25" onblur="KW_calcForm('DistanceFromBristolHidden',100,2,'#DistanceFromBristol','*','1.4')" name="DistanceFromBristol" />
        <a href="../quote/distancefinder.html" target="popup"
 onclick="wopen('../quote/distancefinder.html', 'popup', 400, 150); return false;">Distance Finder </a>
        <input type="hidden" value="" name="DistanceFromBristolHidden" />
        </span></td>
      </tr>
      <tr>
        <th scope="row"><div align="left" class="style1">Number of Cities/Towns Targetted</div></th>
        <td><span style="font-family: Verdana, Arial, Helvetica, sans-serif">
        <input type="text" maxlength="4" size="10" onblur="KW_calcForm('NumberOfLocationsHidden',100,2,'#NumberOfLocations','*','400')" name="NumberOfLocations" style="background-color: rgb(255, 255, 160);" />
        <input type="hidden" value="" name="NumberOfLocationsHidden" />
        </span></td>
      </tr>
      <tr>
        <th scope="row"><div align="left" class="style1">Advert design/consultation needed?</div></th>
        <td><span class="style1">
        <input type="checkbox" value="30" onblur="KW_calcForm('ConsultationNeededHidden',100,2,'#ConsultationNeeded')" name="ConsultationNeeded" />
        <input type="hidden" value="" name="ConsultationNeededHidden" />
        </span></td>
      </tr>
      <tr>
        <th scope="row"><span class="style1"></span></th>
        <td><span class="style1">
        <input type="reset" onclick="reset(); return false;" value="Reset" name="Reset" />
        <input type="button" style="font-weight: bold;")" value="Submit" name="input" onclick="KW_calcForm('Total Cost',100,2,'#NumberOfStencilsHidden','+','#DistanceFromBristolHidden','+','#NumberOfLocationsHidden','+','#ConsultationNeededHidden','+','150')"/>
        </span></td>
      </tr>
      <tr>
        <th scope="row"><div style="text-align: right;">Total Cost £</div></th>
        <td><div align="left" class="style1">
          <input type="text" value="" name="Total Cost" />
        </div></td>
      </tr>
    </table>
   
					</form>



I thank you in advance for any support.

Paul :?
GreyHead 24 Jan, 2009
Hi Paul,

I don't rellay understand the problem. As far as I can see you don't have a 'submit' button on your form - what's there is a 'Calculate' button. Why not just add a Submit button too?

When you say it redirects to another page - what page? ChronoForms usually redirects to a blank page - but before that you can save the data or send emails . . .

Bob
dirtystreetads 24 Jan, 2009
appologies i changed the submit button into a regular button because of the issue you outlined.

I need one submit button to.

a, display the quote (as it's currently doing).
b, submit all the form data to me via email WITHOUT forwarding onto a blank page which it does at the moment.

I dont need to have any user confirmation of quote sent, just need the above to be done in the background.

So what happens is I recieve the information entered by the user, and the user stays on the same page when he recieves his instant quote.

Could you help be do the above?


Kind Regards,


Paul
Max_admin 25 Jan, 2009
Hi Paul,

you will need to remove the <form tags from your page and add this line in the "form tag attachement" field:
onclick="KW_calcForm('Total Cost',100,2,'#NumberOfStencilsHidden','+','#DistanceFromBristolHidden','+','#NumberOfLocationsHidden','+','#ConsultationNeededHidden','+','150')"


you can send the user to some article at your site after the submit by entering the article link in the "Redirect URL" field!

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger