Thank you for all your input. It turns out that to figure out if a change was made on the page, I have to wire-up each and every one of the "input" type fields. And this was my main concern. But that's OK, as long as there is no other way! ;-)
Thanks again everybody. - MB. _____ From: Robert Garcia [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 30, 2007 19:50 To: [email protected] Subject: Re: Witango-Talk: [OT]: Exiting a form (HTML + JavaScript) Yes, the link should be something like this: <a href="javascript:check_exit('someurl');">my link</a> You can use onclick, but then, you should put "javascript:void();" in the href location. This avoids issues with anchors. -- Robert Garcia President - BigHead Technology VP Application Development - eventpix.com 13653 West Park Dr Magalia, Ca 95954 ph: 530.645.4040 x222 fax: 530.645.4040 HYPERLINK "mailto:[EMAIL PROTECTED]"[EMAIL PROTECTED] - HYPERLINK "mailto:[EMAIL PROTECTED]"[EMAIL PROTECTED] HYPERLINK "http://bighead.net"http://bighead.net/ - HYPERLINK "http://eventpix.com"http://eventpix.com/ On May 30, 2007, at 7:18 PM, Stephen Su wrote: Robert, Nice and clean, I assume that you pair this function up with an ===> onClick="check_exit('HYPERLINK "http://www.google.com"http://www.google.com');" type statement within the "<a href" statement correct? - stephen On May 30, 2007, at 7:38 PM, Robert Garcia wrote: Use a JS conditional alert, called confirm() <script language="JavaScript"> <!-- function check_exit(url){ input_box=confirm("You have made changes to the form, are you sure you want to exit this page? Click continue to exit to your link, or cancel to finish the form."); if (input_box==true){ // Output when OK is clicked self.location=url; } else { // Output when Cancel is clicked or just do nothing. } } //--> </script> The only I didn't do here, is the part where you check if the form is changed. You can do that by setting a global variable that is changed to true when any field changes. -- Robert Garcia President - BigHead Technology VP Application Development - eventpix.com 13653 West Park Dr Magalia, Ca 95954 ph: 530.645.4040 x222 fax: 530.645.4040 HYPERLINK "mailto:[EMAIL PROTECTED]"[EMAIL PROTECTED] - HYPERLINK "mailto:[EMAIL PROTECTED]"[EMAIL PROTECTED] HYPERLINK "http://bighead.net"http://bighead.net/ - HYPERLINK "http://eventpix.com"http://eventpix.com/ On May 30, 2007, at 2:13 PM, <HYPERLINK "mailto:[EMAIL PROTECTED]"[EMAIL PROTECTED]> <HYPERLINK "mailto:[EMAIL PROTECTED]"[EMAIL PROTECTED]> wrote: Hi all, My question regards the best way to control the exit from a form that contains both <input>s and links. I would like to be able to warn the user, when he activates a link, that changes were made and the submit button has not been clicked so that he can take the appropriate decision. I have 2 solutions to this issue: 1- make links to act like submit; but this implicitly saves info that he might not want to; 2- use a JavaScript variable that memorizes any change in <input>s and can be evaluated when the user clicks a link; this means that every entry has to be wired-up for the event. I can live with (2), but I thought maybe there is a better/simpler solution, a global "this page has been modified" attribute that can be checked before switching context and I do not have to wire every input. Any thoughts on this subject would be highly appreciated. Many thanks, Mike B. No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.472 / Virus Database: 269.8.3/824 - Release Date: 5/29/2007 13:01 ________________________________________________________________________ TO UNSUBSCRIBE: Go to HYPERLINK "http://www.witango.com/developer/maillist.taf"http://www.witango.com/develo per/maillist.taf ________________________________________________________________________ TO UNSUBSCRIBE: Go to HYPERLINK "http://www.witango.com/developer/maillist.taf"http://www.witango.com/develo per/maillist.taf ________________________________________________________________________ TO UNSUBSCRIBE: Go to HYPERLINK "http://www.witango.com/developer/maillist.taf"http://www.witango.com/develo per/maillist.taf ________________________________________________________________________ TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.472 / Virus Database: 269.8.3/824 - Release Date: 5/29/2007 13:01 No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.472 / Virus Database: 269.8.3/824 - Release Date: 5/29/2007 13:01 ________________________________________________________________________ TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf
