Welcome to Tech Support Forum home to more then 136,000 problems solved. Issues have included: Spyware, Malware, Virus Issues, Windows, Microsoft, Linux, Networking, Security, Hardware, and Gaming Getting your problem solved is as easy as:
1. Registering for a free account
2. Asking your question
3. Receiving an answer

Registered members:
* Get free support
* Communicate privately with other members (PM).
* Removal of this message
* See fewer ads.
* And much more..

 



Want to know how to post a question? click here Having problems with spyware and pop-ups? First Steps
Go Back   Tech Support Forum > Design Forum > Web Design & Programming
User Name
Password
Site Map Register Donate Rules Blogs Mark Forums Read


Web Design & Programming Discussion of web design, and server-side & client-side scripting

Reply
 
LinkBack Thread Tools
Old 04-25-2008, 07:34 PM   #1 (permalink)
Registered User
 
Join Date: Jan 2007
Posts: 108
OS: window XP


Javascript Yes No popup windows

I have a form and when user click on the submit button, a javascript windows will pop up. User can choose yes or no. When click yes, the pop up will close and submit the form and if click no, just close the pop up window.

I know some basic how to create a pop up windows, but just does not know how to make it when click yes, will submit form! I think need to return value true to the form, so the form action will start!

Could someone help me? Thank in advance.

HTML Code:
<form name="form1" method="post" action="process.php" onSubmit="">
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><input type="submit" name="Submit" value="Submit"></td>
    </tr>
  </table>
</form>

Last edited by peterjcs; 04-25-2008 at 07:36 PM.
peterjcs is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Important Information
Join the #1 Tech Support Forum Today - It's Totally Free!

TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free.

Join TechSupportforum.com Today - Click Here

Old 04-25-2008, 08:21 PM   #2 (permalink)
Design Team Member
 
jamiemac2005's Avatar
 
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,884
OS: Vista, various linux distros


Re: Javascript Yes No popup windows

Hey, you can take a look here for the type of box you are looking for and how to use it:

http://www.tizag.com/javascriptT/javascriptconfirm.php

I think what you want to do is something along the lines of this:

Code:
<form ... onSubmit="return confirm('do you want to submit the data?');" ...>
Try it out and if it doesn't work then take a look at that tutorial and i'm sure you'll work it out.

Hope it helps,
Jamey
jamiemac2005 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 04-25-2008, 09:10 PM   #3 (permalink)
Registered User
 
Join Date: Jan 2007
Posts: 108
OS: window XP


Re: Javascript Yes No popup windows

Thank for your reply. But i want to pop up a window. When user click the yes button on pop up windows, then the pop up windows will return true and submit the form.

How to return true to the main form? Is it possible using the javascript opener?
peterjcs is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 04-25-2008, 09:30 PM   #4 (permalink)
Design Team Member
 
jamiemac2005's Avatar
 
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,884
OS: Vista, various linux distros


Re: Javascript Yes No popup windows

oh, so you're going to open a pop-up with yes/no button elements inside, and then act upon that? To be honest i don't know, you may get better help on the javascript part of this forum: www.webdeveloper.com
jamiemac2005 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 04-25-2008, 10:02 PM   #5 (permalink)
Registered User
 
Join Date: Jan 2007
Posts: 108
OS: window XP


Re: Javascript Yes No popup windows

Hai, I finally found the way to do it. But any comment or improvement to the code is appreciated.

Below is the sample:
HTML Code:
<html>
<head>
<title>Untitled Document</title>
<script>
function confirm(url) {

window.open(url, "test", "width=200,height=20");

} 

</script>
</head>

<body>
<form name="form1" method="post" action="submit.html">
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><input type="button" name="Button" value="Button" onClick="confirm('test.html')"></td>
    </tr>
  </table>
</form>
</body>
</html>
HTML Code:
<html>
<head>
<title>Untitled Document</title>
<script>
function submitform(){

window.close();
opener.document.forms['form1'].submit();

}

</script>
</head>

<body>
<p>&nbsp;</p>
<div align="center">
  <input type="button" name="Button" value="Yes" onClick="submitform();">
  &nbsp;&nbsp;
  <input type="button" name="Submit2" value="No" onClick="window.close()">
</div>
</body>
</html>

HTML Code:
<html>
<head>
<title>Untitled Document</title>
</head>

<body>
submit successfully.
</body>
</html>
peterjcs is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -7. The time now is 11:45 AM.



Copyright 2001 - 2009, Tech Support Forum
Home Tips Plus | Outdoor Basecamp | Automotive Support Forum

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85