Saturday, May 11, 2024
 Popular · Latest · Hot · Upcoming
33
rated 0 times [  40] [ 7]  / answers: 1 / hits: 83228  / 11 Years ago, mon, july 15, 2013, 12:00:00

I am looking to create a button at the bottom of a form that will create an alert box that will show the form data entered. Form includes:
First Name
Last Name
Address 1
Address 2
City
State
Zip
Phone
Fax



Once the form is completed, the button is clicked and an alert box pops up showing the form data entered.



Does anyone know how to accomplish without the form actually being submitted or validated? There is no database for the form data to be submitted to, so there is no database to pull the information from.



Any help would be greatly appreciated.



I have not included the form code due to its length, but the current code I am working with for the Alert Box looks like this:



 <script>
function display_alert()
{
alert();
}
</script>

<body>
<input type=button onclick=display_alert() value=Display alert box>
</body>

More From » onclick

 Answers
80

If I get it right you need something like this:



<html>
<head>
<script type=text/javascript>
window.onload = function(){
document.getElementById('send').onclick = function(e){
alert(document.getElementById(name).value);
return false;
}
}
</script>
</head>
<body>
<form method=post>
<input type=text name=name id=name />
<input type=submit name=send id=send value=send />
</form>
</body>
</html>


I don't really get what you mean with a database to pull the information from, but the example uses a click event to get the data from the form field and shows it in an alert without a submit.


[#76996] Saturday, July 13, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kieraelsies

Total Points: 718
Total Questions: 103
Total Answers: 104

Location: England
Member since Sun, May 21, 2023
1 Year ago
;