![]() |
|
|
#1
|
||||
|
||||
|
Can someone please have a look at this code for me please? This works just fine in IE but not in FF. Can someone guide me in the right direction re: which part is the culprit please?
Code:
<SCRIPT LANGUAGE="JAVASCRIPT">
<!--
function CheckForm() {
var Result;
Result = "";
//Result = Result + chkemail(document.theForm.Email.value, ", Email");
//Result = Result + checkDropDown("Property", ", Property");
Result = Result + chkLength(document.theForm.ContactName.value, ", Contact Name");
Result = Result + chkLength(document.theForm.CompanyName.value, ", Company Name");
Result = Result + chkemail(document.theForm.EmailAddress.value, ", Email Address");
Result = Result + chkLength(document.theForm.Password.value, ", Password");
Result = Result + chkLength(document.theForm.ConfirmPassword.value, ", Confirm Password");
//Result = Result + chkLength(document.theForm.YourName.value, ", Your Name");
//Result = Result + chkLength(document.theForm.ContactsSurname.value, ", Surname");
//Result = Result + checkDropDown("Sector", ", Sector");
//Result = Result + checkDropDown("country", ", Country");
if (Result.length > 0) {
document.all['Val'].innerHTML = "Complete the fields: " + Result.substr(1);
return false;
}
else
{
return true;
}
}
//-->
</SCRIPT>
<SCRIPT LANGUAGE="JAVASCRIPT">
<!--
function chkLength(str, response)
{
strReturn = "";
if (str.length < 1) {
strReturn = response;
}
return (strReturn);
}
function checkDropDown(dropDownName, response)
{
strReturn = "";
if (document.theForm[dropDownName].selectedIndex == 0) {
strReturn = response;
}
return (strReturn);
}
function chkemail(str, response) {
strReturn = "";
if (str.length > 0) {
i = str.indexOf("@");
j = str.indexOf(".",i);
k = str.indexOf(",");
kk = str.indexOf(" ");
jj = str.lastIndexOf(".")+1;
len = str.length;
if (!((i > 0) && ( j > (i + 1)) && (k == -1) && (kk == -1) && (len - jj >= 2) && (len - jj <= 3))) {
strReturn = response;
} else {
if (str.length < 1) {
strReturn = response;
}
}
} else {
strReturn = response;
}
return (strReturn);
}
//-->
</SCRIPT>
Code:
<form action="new_go.asp" method="post" name="theForm" onSubmit="Javascript:return(CheckForm());" ID="Form2"><input class=x id=Text1 type=text size=60 name=EmailAddress> <input class=Button id="Submit2" type=submit value=Submit name=Submit1></form> Thank you!
__________________
Try: Sell Your Ad Space - Thousands Of Visitors Want To Buy Your Ad Space Global Internet Index Directory <- Check it out! -> |
|
#2
|
||||
|
||||
|
My web developer toolbar says "Error: document.all has no properties". Google searches seem to suggest innerHTML is not part of the DOM (whatever that may mean) so FF doesn't support it. Can this be true? Ideally I'd rewrite the whole validation to server side but I'll have to give fixing this a try first...
This is the line. Code:
document.all['Val'].innerHTML = "Required fields: " + Result.substr(1);
__________________
Try: Sell Your Ad Space - Thousands Of Visitors Want To Buy Your Ad Space Global Internet Index Directory <- Check it out! -> |
![]() |
| Bookmarks |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| CSS, HTML, FIELDSET, LEGEND, and LABEL tags in FORM | itgl72 | CSS | 2 | Jul 19th 2005 2:15 pm |
| php form entry from list | Pep | PHP | 3 | Feb 20th 2005 6:29 am |
| Retain email form (with errors) after submit | ian_ok | PHP | 5 | Feb 12th 2005 1:33 pm |
| Leads with form on 'my' page? | Sanzbar | Affiliate Programs | 3 | Jan 28th 2005 11:21 am |
| javascript form validation help | NewComputer | JavaScript | 1 | Oct 9th 2004 1:53 am |