•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 374,007 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,917 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1233 | Replies: 6
![]() |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Expires" content="0" /> <!-- disable caching -->
<title>Ajax Example</title>
<script type="text/javascript">
function check(frm) {
var dataIsValid = true;
/* all your validation/processing code goes here */
if(dataIsValid) {
alert("Form successfully submitted!");
return(true);
} else {
return(false);
}
}
</script>
</head>
<body>
<form id="frm" action="#" onsubmit="return check(this);">
<label for="txtName">Name:</label>
<input name="txtName" id="txtName">
<br>
<input type="submit" value="Submit form">
</form>
</body>
</html> "I don't accept change. I don't deserve to live."
"Working a real job is a win if you're lazy, greedy, or unmotivated. If you're average, you fit right in. And if you're above average, the basic terms of employment and premise of the arrangement is against your interests."
"Working a real job is a win if you're lazy, greedy, or unmotivated. If you're average, you fit right in. And if you're above average, the basic terms of employment and premise of the arrangement is against your interests."
•
•
Join Date: Feb 2008
Posts: 5
Reputation:
Rep Power: 0
Solved Threads: 0
Check this code...u can use innerHTML instead of "Alert box"
html Syntax (Toggle Plain Text)
<html> <head> <style> .message {font-family:Arial, ;font-size:15px;color:#FF0000; } </style> <script> function validate(frm) { var dataIsValid = true; var showmsg= document.getElementById("showMesage"); /* your validation codes goes here */ if(dataIsValid) { showmsg.style.visibility = 'visible' ; showmsg.style.display =''; showmsg.innerHTML="Thank you"; return(true); } else { return(false); } } </script> </head> <body> <form id="frm" action="#" onsubmit="return validate(this);"> <table><tr> <td> Name:</td> <td> <input name="txtName" id="txtName"></td></tr> <tr><td colspan="2"> <input type="submit" value="Submit form"></td> </tr> <tr><td id="showMesage" class="message' style="visibility:hidden;display:none"> </td> </table> </form> </body> </html>
Last edited by peter_budo : Mar 6th, 2008 at 5:22 am. Reason: code= html not code = language ;D
•
•
Join Date: Feb 2008
Posts: 26
Reputation:
Rep Power: 1
Solved Threads: 1
Thanqs for ur reply
but i want like in gmail after compose mail we click on send button
then we get inbox screen on that page we will get one msg that is ur message has been sent successfully
like that i want
even js,ajax also ok
in my form(already iam using ajax in jsp) after enter data i click on submit button
it calls another jsp in that data is insert in databse after that without any click it goes to another jsp page on that page i want msg insert successfully
but i want like in gmail after compose mail we click on send button
then we get inbox screen on that page we will get one msg that is ur message has been sent successfully
like that i want
even js,ajax also ok
in my form(already iam using ajax in jsp) after enter data i click on submit button
it calls another jsp in that data is insert in databse after that without any click it goes to another jsp page on that page i want msg insert successfully
•
•
Join Date: Jan 2008
Location: Bangalore, India
Posts: 327
Reputation:
Rep Power: 0
Solved Threads: 31
hi
use one variable isInserted, which will be set true if data is inserted successfully, check its value inside the page and based on this insert a div element which will show the required message.
are u using ajax for submission ?
if ~s.o.s~ code is ok for you, you can insert div element instead of showing alert message in if statement.
use one variable isInserted, which will be set true if data is inserted successfully, check its value inside the page and based on this insert a div element which will show the required message.
are u using ajax for submission ?
if ~s.o.s~ code is ok for you, you can insert div element instead of showing alert message in if statement.
Last edited by DangerDev : Mar 5th, 2008 at 12:30 am.
A computer lets you make more mistakes faster than any invention in human history - with the possible exceptions of handguns and tequila.
~Mitch Ratcliffe
~Mitch Ratcliffe
•
•
Join Date: Feb 2008
Posts: 26
Reputation:
Rep Power: 1
Solved Threads: 1
iam inserting data in
bs_add.jsp (in this i used some ajax code)
after cick submission
it calls bs_insert.jsp( here i didn't use any html code)here iam inserting data into database,
using jsp with out click event iam using sendRedirect go back to the
bs.jsp
In bs.jsp i want get insert data successfully
bs_add.jsp (in this i used some ajax code)
after cick submission
it calls bs_insert.jsp( here i didn't use any html code)here iam inserting data into database,
using jsp with out click event iam using sendRedirect go back to the
bs.jsp
In bs.jsp i want get insert data successfully
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
Similar Threads
- Skip the Recycle Bin Confirmation Message (Windows tips 'n' tweaks)
- Windows Spyware Error Message (Viruses, Spyware and other Nasties)
- repeating the whole program after pressing Yes button in the confirmation message box (Java)
- RUNDLL32.EXE is not responding (Viruses, Spyware and other Nasties)
- HiJack LOg (Viruses, Spyware and other Nasties)
- VX2.BetterInternet....... NOT. (Viruses, Spyware and other Nasties)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Using AJAX and PHP Resources and Tutorial
- Next Thread: problem with drop down SELECT box.



Linear Mode