M
Marc Wilson
I'm amending a website with some Javascript validation code.
I have a piece of HTML code that contains a form, and a JavaScript function
that does some validation. So far so good.
The code works fine in IE. But it fails miserably in NS/Mozilla.
NB- I've simplified this, the validation actually does a lot more than one
field.
The JavaScript function is defined in the <HEAD> element of the page.
The function looks something like...
_______________________________
function AVForm(form)
{
if (form.description1.length > 500)
{ alert('Length of description1 must not exceed 500 characters');
return false;
}
form.submit();
}
_______________________________
The form is something like:
________________________________
<form method="POST" ENCTYPE="multipart/form-data"
action="...url" name="add_description">
There's a textarea called description1
At the end of the form is a clickable image.
<a href="javascript:AVform(add_description);">
<image src="..." alt="Click to submit form">
....
</form>
___________________________________
The problem is- this works fine in IE.
The javascript routine is called, validates the form, if all is well, the
form is submitted and we go on to the next stage.
In Mozillla, nothing happens. If you have the JavaScript console open, you
see a message saying: add_description is not defined.
But add_description is the name of the form that contains the link.
Is there something about passing object references by name that's odd in
Mozillla?
Am I missing something basic and stupid?
I've been going up the wall trying to sort this one out.
Help?
--
Marc Wilson
Cleopatra Consultants Limited - IT Consultants
2 The Grange, Cricklade Street, Old Town, Swindon SN1 3HG
Tel: (44/0) 70-500-15051 Fax: (44/0) 870 164-0054
Mail: (e-mail address removed) Web: http://www.cleopatra.co.uk
_________________________________________________________________
Try MailTraq at https://my.mailtraq.com/register.asp?code=cleopatra
I have a piece of HTML code that contains a form, and a JavaScript function
that does some validation. So far so good.
The code works fine in IE. But it fails miserably in NS/Mozilla.
NB- I've simplified this, the validation actually does a lot more than one
field.
The JavaScript function is defined in the <HEAD> element of the page.
The function looks something like...
_______________________________
function AVForm(form)
{
if (form.description1.length > 500)
{ alert('Length of description1 must not exceed 500 characters');
return false;
}
form.submit();
}
_______________________________
The form is something like:
________________________________
<form method="POST" ENCTYPE="multipart/form-data"
action="...url" name="add_description">
There's a textarea called description1
At the end of the form is a clickable image.
<a href="javascript:AVform(add_description);">
<image src="..." alt="Click to submit form">
....
</form>
___________________________________
The problem is- this works fine in IE.
The javascript routine is called, validates the form, if all is well, the
form is submitted and we go on to the next stage.
In Mozillla, nothing happens. If you have the JavaScript console open, you
see a message saying: add_description is not defined.
But add_description is the name of the form that contains the link.
Is there something about passing object references by name that's odd in
Mozillla?
Am I missing something basic and stupid?
I've been going up the wall trying to sort this one out.
Help?
--
Marc Wilson
Cleopatra Consultants Limited - IT Consultants
2 The Grange, Cricklade Street, Old Town, Swindon SN1 3HG
Tel: (44/0) 70-500-15051 Fax: (44/0) 870 164-0054
Mail: (e-mail address removed) Web: http://www.cleopatra.co.uk
_________________________________________________________________
Try MailTraq at https://my.mailtraq.com/register.asp?code=cleopatra