Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

On submit, are you sure window pop up?

Status
Not open for further replies.

Dirtrocker

Technical User
Mar 31, 2002
74
US
Any help on this would be appreciated.

Here is what I am trying to do. I have a preview message button. I would like to set it up that when they click on the submit button, it pops up a little window that asks if they supplied the information needed? When they click ok, it closes the little window and proceeds or they can click no and it closes the little window and lets them enter the info. The code I am working with is below.
I'm not sure where to start.


<FORM METHOD=&quot;post&quot; ACTION=&quot;$databoard_url&quot;>
<INPUT TYPE=&quot;hidden&quot; NAME=&quot;forum_name&quot; VALUE=&quot;$forum_name&quot;>
<INPUT TYPE=&quot;hidden&quot; NAME=&quot;pid&quot; VALUE=&quot;$form_data{'pid'}&quot;>
<INPUT NAME=&quot;form_action&quot; TYPE=&quot;hidden&quot; VALUE=&quot;$form_data{'form_action'}&quot;>


<INPUT NAME=&quot;name&quot; TYPE=&quot;hidden&quot; VALUE=&quot;$form_data{'name'}&quot;>
<INPUT NAME=&quot;email&quot; TYPE=&quot;hidden&quot; VALUE=&quot;$form_data{'email'}&quot;>
<INPUT NAME=&quot;subject&quot; TYPE=&quot;hidden&quot; VALUE=&quot;$form_data{'subject'}&quot;>
<INPUT NAME=&quot;body&quot; TYPE=&quot;hidden&quot; VALUE=&quot;$body_text&quot;>
<INPUT NAME=&quot;notify_me&quot; TYPE=&quot;hidden&quot; VALUE=&quot;$form_data{'notify_me'}&quot;>
<INPUT NAME=&quot;post_type&quot; TYPE=&quot;hidden&quot; VALUE=&quot;$form_data{'post_type'}&quot;>
<INPUT NAME=&quot;link_url&quot; TYPE=&quot;hidden&quot; VALUE=&quot;$form_data{'link_url'}&quot;>
<INPUT NAME=&quot;link_title&quot; TYPE=&quot;hidden&quot; VALUE=&quot;$form_data{'link_title'}&quot;>
<INPUT NAME=&quot;image_url&quot; TYPE=&quot;hidden&quot; VALUE=&quot;$form_data{'image_url'}&quot;>
<INPUT NAME=&quot;parent&quot; TYPE=&quot;hidden&quot; VALUE=&quot;$form_data{'parent'}&quot;>
<INPUT NAME=&quot;children&quot; TYPE=&quot;hidden&quot; VALUE=&quot;$form_data{'children'}&quot;>

<br><br>
<center>
<INPUT TYPE=&quot;submit&quot; VALUE=&quot;$preview_button&quot;>
</center>
</form>

 
Just a suggestion....

Whenever you want a user to input information into a form, database, etc., it is best to verify the data you want BEFORE submitting the form or adding the data to the data base. This is called data validation and should ALWAYS be done at time of data entry.

In your case, I'd use javascript to validate the data that you want the user to enter. When they click the Submit button, the javascript will verify their data entry and if all is OK, it will pass the info on to your CGI script (or whatever). If data is invalid, it will tell the user and direct them back to the area that needs attention. This will eliminate the need for you to ask the user if they've entered the data.

Check out the Javascript forums for more info.

There's always a better way...
 
I don't want the script to validate anything.
I just want an alert to pop up, then if the click cancel, keeps them on the page, if they click ok, goes on.

I just need to remind them that specific info is needed. If they choose not to provide that info after that, then it is their problem, not mine.
 
This has to be done throught JavaScript

<script>
<!--
function PopWindow01()
{
window.open('popup.html','popwin01','width=400,height=380,menubar=no,scrollbars=no,toolbar=no,location=no,directories=no,resizable=no,top=100,left=200');
}
//-->
</script>

then you just need this in the body of your page

<a href=&quot;JavaScript:popWindow01()&quot; name=&quot;popwin&quot; ><img src=&quot;yourimage.gif&quot;></a>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top