471,338 Members | 1,031 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Javascript firefox problem

Hi,
I have a problem with our intranet, we are planning to install Firefox
instead of Internet Explorer onto some new PCs.

However, we can't get the following JavaScript to work in Firefox and
similar code is used in lots of the intranet stuff.
The code should bring up a message box with a warning and not allow
the user to continue unless they have filled in the entry in an html
form (the form is called 'myauthor').
if (checkempty(Document.myauthor.Candidate.Value,"You have left the
Candidate field empty."))= false then validation=false
If validation= True then
myauthor_OnSubmit = True
else
myauthor_OnSubmit = False
End if
End function
Function checkempty(ByVal FieldValue, ByVal message)
If FieldValue = "" then
MsgBox message, 8, Header
checkempty = False
else
checkempty = true
End if
end function

No errors or warnings appear in the firefox JavaScript console. The
page just accepts the form and continues as if the checking code
weren't there at all.

Thanks for any help,
Dave

Jul 23 '05 #1
4 3564


Dave Blair wrote:

However, we can't get the following JavaScript to work in Firefox and
similar code is used in lots of the intranet stuff.
The code should bring up a message box with a warning and not allow
if (checkempty(Document.myauthor.Candidate.Value,"You have left the
Candidate field empty."))= false then validation=false
If validation= True then
myauthor_OnSubmit = True
else
myauthor_OnSubmit = False
End if
End function
Function checkempty(ByVal FieldValue, ByVal message)
If FieldValue = "" then
MsgBox message, 8, Header
checkempty = False
else
checkempty = true
End if
end function

No errors or warnings appear in the firefox JavaScript console. The
page just accepts the form and continues as if the checking code
weren't there at all.


That is not JavaScript but VBScript so there is no way FireFox or any
other browser besides IE/Win is going to run that code.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 23 '05 #2
Dave Blair wrote:
Hi,
I have a problem with our intranet, we are planning to install Firefox
instead of Internet Explorer onto some new PCs.

However, we can't get the following JavaScript to work in Firefox and
similar code is used in lots of the intranet stuff.
The code should bring up a message box with a warning and not allow
the user to continue unless they have filled in the entry in an html
form (the form is called 'myauthor').
if (checkempty(Document.myauthor.Candidate.Value,"You have left the
Candidate field empty."))= false then validation=false
If validation= True then
myauthor_OnSubmit = True
else
myauthor_OnSubmit = False
End if
End function
Function checkempty(ByVal FieldValue, ByVal message)
If FieldValue = "" then
MsgBox message, 8, Header
checkempty = False
else
checkempty = true
End if
end function

No errors or warnings appear in the firefox JavaScript console. The
page just accepts the form and continues as if the checking code
weren't there at all.

Thanks for any help,
Dave


Hmm ... perhaps it's because most of the code, you've written isn't
Javascript - but rather VBScript which is also supported in IE

i've taken the liberty to rewrite it (sort of) in javascript...

function checkEmpty( value, errMessage ) {
if(value=="") {
Alert( errMessage );
return false;
} else {
return true;
}
}
if( checkEmpty( document.forms['myauthor'].candidate.value, "You have
left the Candidate field empty..." ) ) {
/* validation ok - submit the form */
document.forms['myauthor'].submit();
} else {
/* don't do anything - vaidation failed */
return false;
}

/Søren Munk Skrøder
Odense, Denmark
soeren at skroeder dot dk
Jul 23 '05 #3
I'm an idiot!!

I knew it was VBscript, but had just finished with another problem
that was Javascript (a menu, which is now working). And somehow my
brain hadn't woken up and...........monday morning.....and......

Anyway, thanks for the replies and the re-write!

On Mon, 28 Jun 2004 14:45:06 +0200,
=?ISO-8859-1?Q?S=F8ren_Munk_Skr=F8der?= <a@b.com> wrote:
Dave Blair wrote:
Hi,
I have a problem with our intranet, we are planning to install Firefox
instead of Internet Explorer onto some new PCs.

However, we can't get the following JavaScript to work in Firefox and
similar code is used in lots of the intranet stuff.
The code should bring up a message box with a warning and not allow
the user to continue unless they have filled in the entry in an html
form (the form is called 'myauthor').
if (checkempty(Document.myauthor.Candidate.Value,"You have left the
Candidate field empty."))= false then validation=false
If validation= True then
myauthor_OnSubmit = True
else
myauthor_OnSubmit = False
End if
End function
Function checkempty(ByVal FieldValue, ByVal message)
If FieldValue = "" then
MsgBox message, 8, Header
checkempty = False
else
checkempty = true
End if
end function

No errors or warnings appear in the firefox JavaScript console. The
page just accepts the form and continues as if the checking code
weren't there at all.

Thanks for any help,
Dave


Hmm ... perhaps it's because most of the code, you've written isn't
Javascript - but rather VBScript which is also supported in IE

i've taken the liberty to rewrite it (sort of) in javascript...

function checkEmpty( value, errMessage ) {
if(value=="") {
Alert( errMessage );
return false;
} else {
return true;
}
}
if( checkEmpty( document.forms['myauthor'].candidate.value, "You have
left the Candidate field empty..." ) ) {
/* validation ok - submit the form */
document.forms['myauthor'].submit();
} else {
/* don't do anything - vaidation failed */
return false;
}

/Søren Munk Skrøder
Odense, Denmark
soeren at skroeder dot dk


Jul 23 '05 #4
Dave Blair wrote:
Hi,
I have a problem with our intranet, we are planning to install Firefox
instead of Internet Explorer onto some new PCs.

However, we can't get the following JavaScript to work in Firefox and
similar code is used in lots of the intranet stuff. [snip]
Function checkempty(ByVal FieldValue, ByVal message)
If FieldValue = "" then
MsgBox message, 8, Header
checkempty = False
else
checkempty = true
End if
end function

That code (above) is VBScript, not JavaScript or ECMAScript, so it has
no chance on anything except Microsoft-only browsers written to work
with Micrososft-only code. In other words - it will never run on Firefox
OR on any non-Wondows system.
Jul 23 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by Howard Kaikow | last post: by
5 posts views Thread by LRW | last post: by
2 posts views Thread by John | last post: by
8 posts views Thread by chrisdude911 | last post: by
11 posts views Thread by minnesotti | last post: by
7 posts views Thread by Adam | last post: by
16 posts views Thread by Eric | last post: by
6 posts views Thread by scotty | last post: by
reply views Thread by rosydwin | last post: by

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.