Ok, so I've found what the problem with IE was - it didn't like 'length' as variable name. Weird, but what the heck, I changed it and now it works:
Code: Select all
function check_empty(fields)
{
l = fields.length;
for (i = 0; i < l; i++)
{
if (document.forms[0].elements[fields[i][0]].value == '')
{
alert(fields[i][1] + ' field cannot be empty.');
document.forms[0].elements[fields[i][0]].focus();
return false;
}
}
}
However I have yet another question about weird behaviour of both IE and FF when using
FCKeditor.
IE:
When FCKeditor area is empty, IE pops the alert as required, but it ALSO submits the form right after that which shouldn't happen.
FF:
When FCKeditor area is empty, FF pops the alert as required and doesn't submit the form. BUT if the area is filled, the first time form submission button is pressed, it still pops the alert. When you press the form button again, the form is submitted fine.
Any of you had some similar problems before? I'm really unsure what the problem could be, the JS function I use is really simple. What could be the cause of this weird behaviour?
feyd?
