W
winstontuck
Hi
I am fairly new to javascript and html and I have the following
problem.
I have a page lets say page1. When something changes on page1 i set a
variable PossiblePageChanged to true. On page1 I have a link with
the
following properties : <A href="applypage1settings..and some
otherstuffhere" onclick="return CheckforPossibleChanges()">Page2</a>
When the user clicks in the link to Page2, it successfully detects
that the page has changed (if so) and give you the confirmation
message.
The problem is that if you click OK it does not always submit the
page1form (The httpserver does not always get the applypage1settings
request.)
It looks like it is normally from remote locations other than the
machine the http server is running on. Is this possible to do or is
there a different way.
Below is my javascript.
var PossiblePageChanged = false;
function CheckforPossibleChanges(){
if (PossiblePageChanged==true) {
conf = confirm('Click OK to your apply your changes or Cancel to
discard.')
if (conf==true){
return submitform();
}
}
}
function SubmitAForm(formname, formReference, ExtraParams){
var ExtraParamsStr ="";
if (ExtraParams) {if (ExtraParams!="") {ExtraParamsStr = "?" +
ExtraParams}};
form = document.getElementById(formname);
var s = form.action;
s = s.substring(s.length-32, s.length);
s = formReference+"?" + s + ExtraParamsStr;
form.action = s;
form.submit();
}
function submitform(){
if (CanApplyPage1Changes()==false) {return false;}
SubmitAForm("page1form", "applypage1settings")
}
I am fairly new to javascript and html and I have the following
problem.
I have a page lets say page1. When something changes on page1 i set a
variable PossiblePageChanged to true. On page1 I have a link with
the
following properties : <A href="applypage1settings..and some
otherstuffhere" onclick="return CheckforPossibleChanges()">Page2</a>
When the user clicks in the link to Page2, it successfully detects
that the page has changed (if so) and give you the confirmation
message.
The problem is that if you click OK it does not always submit the
page1form (The httpserver does not always get the applypage1settings
request.)
It looks like it is normally from remote locations other than the
machine the http server is running on. Is this possible to do or is
there a different way.
Below is my javascript.
var PossiblePageChanged = false;
function CheckforPossibleChanges(){
if (PossiblePageChanged==true) {
conf = confirm('Click OK to your apply your changes or Cancel to
discard.')
if (conf==true){
return submitform();
}
}
}
function SubmitAForm(formname, formReference, ExtraParams){
var ExtraParamsStr ="";
if (ExtraParams) {if (ExtraParams!="") {ExtraParamsStr = "?" +
ExtraParams}};
form = document.getElementById(formname);
var s = form.action;
s = s.substring(s.length-32, s.length);
s = formReference+"?" + s + ExtraParamsStr;
form.action = s;
form.submit();
}
function submitform(){
if (CanApplyPage1Changes()==false) {return false;}
SubmitAForm("page1form", "applypage1settings")
}