Solved

ASP + Alert box, passing a value

Posted on 2004-10-07
8
297 Views
Last Modified: 2006-11-17
I have an ASP page form that has an input field called 'bid'

<input name="bid" type="text"  size="30">

Once a bid amount is entered and then the submit button clicked, I would like an alert box to pop up and say.

You are placing a bid in the amount of XYZ.  With XYZ being the amount they entered in the input box.

This is what I have so far but it obviously does not work.


<input name="bid" type="text"  size="30">

<input type="submit"   value="Submit"   onClick="alert('You are placing a bid in the amount of ' +documnet.form1.bid.value)">



Or, is there a better way to do this ?

0
Comment
Question by:pgooseman
  • 2
  • 2
  • 2
  • +2
8 Comments
 
LVL 23

Expert Comment

by:apresto
Comment Utility
You could use javascript onsubmit event instead...
0
 
LVL 12

Accepted Solution

by:
kingsfan76 earned 25 total points
Comment Utility
the word "documnet" should spell "document"

besides that, it should work.  just make sure you spell the form name correctly, and make sure that "bid" input is inside the <form></form> tag
0
 
LVL 1

Assisted Solution

by:hansam
hansam earned 25 total points
Comment Utility
<script>
function SendBid(){
alert("You are placing a bid in the amount of " +document.form1.bid.value);
document.form1.submit(document.form1);
}
</script>

<input name="bid" type="text"  size="30">

<input type="button"   value="Submit"   onClick="SendBid();">
0
 
LVL 19

Expert Comment

by:peh803
Comment Utility
This code works for me (Note that you had spelled "document" wrong in your original post):

<form name=form1>
  <input name="bid" type="text"  size="30">
  <input type="submit"   value="Submit"   onClick="alert('You are placing a bid in the amount of ' +document.form1.bid.value)">
</form>

regards,
peh803
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 19

Expert Comment

by:peh803
Comment Utility
@kingsfan76 -- sorry for the repost!  No harm inteded.  

peh803
0
 
LVL 23

Expert Comment

by:apresto
Comment Utility
Looks like you can get your current mthod working but if all fails check here for an alternative method:

www.codeave.com/javascript/code.asp?u_log=7035
0
 
LVL 12

Expert Comment

by:kingsfan76
Comment Utility
@peh803

no harm taken  :)

kingsfan
0
 

Author Comment

by:pgooseman
Comment Utility
Thanks for the help.

One last question.

I set it up as a function and it works fine.  However, when I click "Ok" it does not submit the form.

Here is the code.

<!--hide script from older browsers

// JavaScript to verify bid

 
function SendBid()
{
confirm("You are about to submit a bid in the amount of $" + document.form1.bid.value +  "\n Tax will be appplied to your  bid");

 
}


//end script-->


Do I have to put in a return false or return true somewhere ?
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now