.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old October 24th, 2000, 08:26 AM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 22
Client Side and Server Side Code

<i><b>Originally posted by : Zed (tanenlai@commerce.com.sg)</b></i><br />Hi guys,<br /><br /> I have a runat="server" form. When I click on the submit form. I want to call some client side JavaScript to pop up a confirmation message box. Then I want the JavaScript code to submit the form back to ASP+. How can it be done?<br /><br />Thanks.<br /><br /><script language="JavaScript"><br /> function PromptConfirm()<br /> {<br /> if (confirm('Are you sure?') == true)<br /> {<br /> //This part is probably wrong, but you get the idea.<br /> document.form.submit()<br /> }<br /> return<br /> }<br /></script><br /><br /><form runat="server"><br />...<br /><br /><Input Type="Button" Value="Submit" onclick="PromptConfirm"><br /><br /></form>

Reply With Quote
  #2  
Old December 12th, 2000, 07:03 AM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 22
<i><b>Originally posted by : Andrew Taylor (andrew.taylor@analysys.com)</b></i><br />I think the best way to do this is with the<br />onSubmit event: this also copes with the case<br />where the form is submitted by the user<br />presing Enter instead of clicking on a <br />button. Roughly speaking you do it like this:<br /><br />for the <form> tag:<br /><Form name="myForm" action="whatever.asp" onSubmit="return checkSubmit()"><br /><br />in <Script><br />Function checkSubmit()<br />{<br /> if (confirm ("Do you really want to submit?"))<br /> return true;<br /> else<br /> return false;<br />}<br /><br />or you can abbreviate the code to<br />return confirm ("Do you really want to submit?")<br /><br />You can also use this technique to validate the<br />data in the form..<br /><br />if (...data invalid...)<br />{<br /> alert ("Please correct errors...");<br /> return false;<br />}<br /><br /><br />HTH<br />Andrew<br /><br /><br /><br /><br />------------<br />Zed at 10/24/2000 6:26:32 AM<br /><br />Hi guys,<br /><br /> I have a runat="server" form. When I click on the submit form. I want to call some client side JavaScript to pop up a confirmation message box. Then I want the JavaScript code to submit the form back to ASP+. How can it be done?<br /><br />Thanks.<br /><br /><script language="JavaScript"><br /> function PromptConfirm()<br /> {<br /> if (confirm('Are you sure?') == true)<br /> {<br /> //This part is probably wrong, but you get the idea.<br /> document.form.submit()<br /> }<br /> return<br /> }<br /></script><br /><br /><form runat="server"><br />...<br /><br /><Input Type="Button" Value="Submit" onclick="PromptConfirm"><br /><br /></form>

Reply With Quote
Reply

Viewing: ASP Free ForumsProgramming.NET Development > Client Side and Server Side Code


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway