Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: asp coding

  1. #1
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    asp coding

    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

  • #2
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    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.
    To say my fate is not tied to your fate is like saying, 'Your end of the boat is sinking.' -- Hugh Downs
    Please, if you found my post helpful, pay it forward. Go and help someone else today.

  • #3
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #4
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    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:

    Code:
    <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

    Code:
    <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.
    To say my fate is not tied to your fate is like saying, 'Your end of the boat is sinking.' -- Hugh Downs
    Please, if you found my post helpful, pay it forward. Go and help someone else today.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •