...

View Full Version : asp coding



cldaniel1044
06-06-2007, 02:09 PM
I am trying to enter a number in a text box and saving that number to a total location.

Amount:________ (type in number)
Save this number to a total location on a form.

Any help will be appreciated.

Thanks

Daemonspyre
06-06-2007, 03:05 PM
You can use the request.form() method and session variables to get and post the information.

However, I think that we need a little more information to totally answer your question.

cldaniel1044
06-08-2007, 05:04 PM
This is what I came up with, but its placing the 200 value in the total amount
area. I need to allow a user to type in any number and that number is saved to the total amount area.
What do i need to change and what is missing?

<INPUT type="text" name="Amount" value=”200”>

<INPUT type="text" name="Donated" value="<%=Request(“Amount”)%>">

Someone told me I needed a form tag with Action and Method mentioned.

Daemonspyre
06-08-2007, 09:11 PM
Remove the value from your Amount input. When you put a value there, it becomes the "default value".

If you are only trying to update one field with another on the same page without a form POST/page reload, then you need to use JavaScript, not ASP.

For example:



<script language="javascript">
function setDonated() {
var Amount = document.myForm.Amount
var Donated = document.myForm.Donated

if(Amount.value != "") Donated.value = Amount.value;
}
</script>

<form method="post" name="myForm">
<INPUT type="text" name="Amount" value="" onkeypress="setDonated();">
<INPUT type="text" name="Donated" value="">
</form>


With a Form POST/page reload



<form method="post" name="myForm">
<INPUT type="text" name="Amount" value="">
<INPUT type="text" name="Donated" value="<%= Request.Form("Amount") %>">
</form>


Not what you want??

Be a little more specific on what you need and I will help as best I can. Right now, you are being a little vague in what you need besides updating one field to another, so I can't really say what you need to do.

By reasonable deduction, it looks as though you are trying to create an online donation form.

If so, you will definitely need a FORM tag, with an ACTION (place to post the form information).

You will need to use some JavaScript or ASP processing to determine if the values in your AMOUNT and DONATED fields are numbers. I find it easier in ASP, but others find it easier in JavaScript. It's all up to you.

You will need to use either JavaScript or ASP post-processing to add all of your values together to get the TOTAL amount. Again, can be easily done in both.

Hope this gets you on the right track. Try posting some examples of what you are looking at doing and we can help out a little more thoroughly.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum