SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    if ($zee == "Guru") { $zee--;}
    Join Date
    Nov 2005
    Location
    Karachi - Pakistan
    Posts
    1,133
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Javascript Data Entry Confirmation

    Hi Bosses.

    I have a HTML form with a lot of fields. Upon submit it calls a javascript function to validate the data. and then transfer the data to a php script.

    Now i want that if a user CLICK Submit, it will first show a POPUP saying

    "Please check the data you entered below"
    Name : blah name
    Address : blah address
    more data...


    then a button saying "Yes I confirm, data are OK" and another "No, I wanna change some data"

    so if the user clicks on YES, it will call the javascript form validation routine. and then transfer the data to php. else if NO is clicked then it will simple do nothing and closes the POPUP.

    Please guide !

  2. #2
    SitePoint Member
    Join Date
    Feb 2004
    Location
    Chicago
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This will help you
    Code:
    <html>
    <head>
    
    
    
    <script language="javascript">
    
    
    <!-- The function that submits the form-->
    
    function submitform()
    {
    //Perform validations here
    if(1!=1)
    {
    }
    
     else
     {
     	getMessage();
     }
    
    }
    
    
    function getMessage() { var ans; ans=window.confirm('Is it your confirmation.....?');
    //alert (ans);
    	if (ans==true)
    	{
    		//alert('Yes');
    		document.myform.hdnbox.value='Yes';
    	}
    	else
    	{
    		//alert('No');
    		document.myform.hdnbox.value='No';
    	}
    }
    </script>
    
    
    </head>
    
    	<body>
    <form name="myForm" action="validate.php">
    Name: <input type="text" name="username" />
    Time: <input type="text" name="time" />
    <A href="javascript: submitform()">Submit</A>
    </form>
    
    </body>
    </html>
    Primary email: advanced.programmer@gmail.com
    MSN/Email: advanced_programmer@hotmail.com

  3. #3
    if ($zee == "Guru") { $zee--;}
    Join Date
    Nov 2005
    Location
    Karachi - Pakistan
    Posts
    1,133
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks a lot for your help. But i do not want to use the alert window. I want to make a small html so that the valus that user enterd can be displayed there.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •