Mike,
You are correct, sorry for not pointing these items out earlier.
1) I was building on Robert's comments about needing to do this
whenever an input item is modified.
2) however, the need for someurl target should not be needed, because
the browser will advance forward to the clicked item or it can be
resolved easily enough . . . however, it looks like indeed your
solution below is just right.
I'll be sure to work out more details of the code in my future postings.
All the best,
Stephen
On May 31, 2007, at 12:57 AM, <[EMAIL PROTECTED]>
<[EMAIL PROTECTED]> wrote:
Hi Stephen,
There are some issues here:
1- there is nothing to say some input has been modified; Robert
mentioned that in his first message on this subject;
2- there can be more than just one "someurl" in the form; so I do
not think the onUnload option covers that situation.
However, while searching for a solution on the Internet, I found
(slightly modified and attached) an example of javascript code that
does exactly what I needed.
Based on checking current with default values, it works beautifully
not only with links but also with browser buttons; and it does not
need to add any event handlind to inputs.
(I wish I could give credit to the author, but I could not find any
info about him)
Thanks everybody,
MB.
From: Stephen Su [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 30, 2007 20:33
To: [email protected]
Subject: Re: Witango-Talk: [OT]: Exiting a form (HTML + JavaScript)
Mike,
You may actually be able to avoid the NEED TO CODE EVERY INPUT by
building on Robert's code.
Simply input this into the BODY TAG of your code.
<body onUnload="javascript:check_exit('someurl');">
I have not try this code myself yet so it is just theory, but
should work.
Try it and let us know.
: ) stephen
On May 30, 2007, at 11:11 PM, <[EMAIL PROTECTED]>
<[EMAIL PROTECTED]> wrote:
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
[EMAIL PROTECTED] - [EMAIL PROTECTED]
http://bighead.net/ - 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('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
[EMAIL PROTECTED] - [EMAIL PROTECTED]
http://bighead.net/ - http://eventpix.com/
On May 30, 2007, at 2:13 PM, <[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 http://www.witangocom/developer/maillist.taf
___________________________________________________________________
_____
TO UNSUBSCRIBE: Go to http://www.witangocom/developer/maillist.taf
____________________________________________________________________
____
TO UNSUBSCRIBE: Go to http://www.witangocom/developer/maillist.taf
_____________________________________________________________________
___
TO UNSUBSCRIBE: Go to http://www.witangocom/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.witangocom/developer/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
Go to google
________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf