Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculate without reload

Status
Not open for further replies.

haneen97

Programmer
Dec 10, 2002
280
US
Hi,
I am trying to calculate few fields. I used the submit button but it reloads the entire page and I loose all the data on the page. Can someone please suggest a better way of doing that?
Thanks

Mo
 
either make a button that is not the submit button and have it call a function

or add a function call to the onSubmit event of the form and return false if you dont want to actually submit it, ie: fails validation.

PS: The JavaScript forum is the best place for client side scripting questions. forum216
 
are use the onMouseOver call on something any thing (link,textfield,submitbutton)
 
Hi Steve,

This is the form and the included objects. All I want to do is allow the submit buttons on the buttom to trigger the two methods after clicking or submitting. I don't want it to refresh the page so to not lose the values in the text boxes and drop downs.

Sorry took so long to response, long weekend :)

<td width="20%"><form action="" method="post" name="frmCalc" id="frmCalc">
<div align="center">
<p><font size="2" face="Arial, Helvetica, sans-serif"><strong>Charges</strong></font></p>
<p align="left"><strong><font size="2" face="Arial, Helvetica, sans-serif">Sub
Total:
<input name="txtSubTotal" type="text" id="txtSubTotal" style="width:50px;" value="<% Response.Write ("0") %>">
</font></strong></p>
<p align="left"><font size="2" face="Arial, Helvetica, sans-serif"><strong>Discount
%: </strong>
<input name="txtDiscount" type="text" id="txtDiscount" style="width:50px;" value="<% Response.Write ("0") %>">
</font></p>
<p align="left"> <font size="2" face="Arial, Helvetica, sans-serif"><strong>Extra
Charges:
<input name="txtExtraCharges" type="text" id="txtExtraCharges" style="width:50px;" value="<% Response.Write ("0") %>">
</strong></font></p>
<p align="left"><font size="2" face="Arial, Helvetica, sans-serif"><strong>Total
Cost:
<input name="txtTotal" type="text" id="txtTotal" style="width:70px;" value="<% Response.Write ("0") %>">
</strong></font></p>
<p align="left"><font size="2" face="Arial, Helvetica, sans-serif"><strong>Amount
Paid:
<input name="txtAmtPaid" type="text" id="txtAmtPaid" style="width:70px;" value="<% Response.Write ("0") %>">
</strong></font></p>
<p align="left"><font size="2" face="Arial, Helvetica, sans-serif"><strong>
Unpaid:
<input name="txtUnpaid" type="text" id="txtUnpaid" style="width:70px;" value="<% Response.Write ("0") %>">
</strong></font></p>
<p align="left"><strong><font size="2" face="Arial, Helvetica, sans-serif">
<input name="pCalculate" type="submit" id="pCalculate" value="Calculate" onSubmit="Calculate()">
<input name="pReset" type="submit" id="pReset" value="Reset" onSubmit="Reset()">
</font></strong></p>
</div>
</form></td>





Mo
 
Like Sheco said, this should be in the Javascript forum. ASP is server side, and doesn't interact with the page once it's been delivered to the client computer.

Lee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top