in my form after filling all details
click on the submit button
after inserting the data iam getting the same page with empty fields, till this ok

i want to display in that form one confirmation message along with empty fields like
Date inserted successfully

<!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>

Check this code...u can use innerHTML instead of "Alert box"

<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">&nbsp;</td>
</table>

   </form>
</body>
</html>

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

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.

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

hi
redirect to the bs.jsp with some GET of POST data, on the basis of this data you can design bs.jsp such that it will show the message.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.