DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/)
-   JavaScript / DHTML / AJAX (http://www.daniweb.com/forums/forum117.html)
-   -   Confirmation message (http://www.daniweb.com/forums/thread111993.html)

brr Mar 3rd, 2008 10:41 am
Confirmation message
 
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

~s.o.s~ Mar 3rd, 2008 12:17 pm
Re: Confirmation message
 
<!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>

zabindia Mar 4th, 2008 6:10 am
Re: Confirmation message
 
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>

brr Mar 5th, 2008 12:14 am
Re: Confirmation message
 
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

DangerDev Mar 5th, 2008 12:28 am
Re: Confirmation message
 
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.

brr Mar 5th, 2008 7:55 am
Re: Confirmation message
 
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

DangerDev Mar 5th, 2008 8:25 am
Re: Confirmation message
 
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.


All times are GMT -4. The time now is 3:33 pm.

Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC