473,397 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Javascript Submit Problem

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")
}

Mar 9 '07 #1
1 1342
On 9 Mar, 07:20, winstont...@gmail.com wrote:
>
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>
You need to ensure that all the paths through your code will
ultimately return false. Otherwise, after the javascript has finished,
this link will be activated. Crucially, the link may well be followed
*before* the form is submitted. If that happens, the form will not
actually get submitted, because you've navigated away from the page
before it happened.

wp.

Mar 9 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Shaun Fleming | last post by:
I've been trying to make this simple script compatible across various browsers. It works for IE 6.0 and NS 7 but doesnt work with Opera (I have version 7.11). This is what is supposed to happen:...
2
by: Margaret Werdermann | last post by:
Hi all: I'm having a nasty time with a particularly difficult piece of code and was hoping someone might be able to help me. I have a FormMail form that originally worked perfectly. Then, I...
4
by: fig000 | last post by:
Hi, I'm relatively new to Javascript so please bear with me on what might sound like silly questions. This is what I want to do: I'm working in classic asp (I have to for this project). I...
6
by: Joop | last post by:
Hi all, I'm kinda new to JavaScript, but hey... I'm trying anyway! ;-) So, here's my problem : I've created a table in my document, presenting a list of items, one can 'select' by clicking...
14
by: tshad | last post by:
I posted this on the asp.net group, also. I wasn't sure whether this was an asp.net problem or a javascript problem. I have a page that was originally created from a program I found on the net...
9
by: tshad | last post by:
This is from my previous post, but a different issue. I have the following Javascript routine that opens a popup page, but doesn't seem to work if called from an asp.net button. It seems to work...
4
by: dschruth | last post by:
Hello. Can anybody solve this problem? I am using a server-side language (PERL) to *try* to POST data to a HTTPS login script that doesn't have a standard "submit" button. The form appears...
10
by: IchBin | last post by:
I am trying to set the state of a radio button. I do not see what I am doing wrong. Sorry, I am new at this.. I need another set of eyes to look at this snip of code. I am trying to set the radio...
5
by: Rabel | last post by:
I am a flash designer so I dont know a whole lot about the javascript submit buttons (I may not even be describing it right sorry) but here is the code I am using. <IMG name="Checkout"...
14
by: Mtek | last post by:
Hi, We have a form defined with buttons like this: <a class="save_menu" href="javascript:document.Detail_Screen.action = 'savedata.php?screen=EDIT';document.Detail_Screen.submit();">Update</...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.