TrueBlue
asked on
Frontpage 2003 generated form validation javascript is shown in NS 7.01
Hi!
I have a page with a form on it.
It works fine using IE.
If you use NS 7.01 the page for some reason shows the javascript that Front Page generates to validate the various input fields.
<FORM ACTION="sendeform.asp" METHOD="POST" onsubmit="return FrontPage_Form1_Validator( this)" language="JavaScript" name="FrontPage_Form1">
Any ideas what I am doing wrong?
Thankyou in advance.
I have a page with a form on it.
It works fine using IE.
If you use NS 7.01 the page for some reason shows the javascript that Front Page generates to validate the various input fields.
<FORM ACTION="sendeform.asp" METHOD="POST" onsubmit="return FrontPage_Form1_Validator(
Any ideas what I am doing wrong?
Thankyou in advance.
ASKER
Hi Corey!
Can I copy the FP generated javascript to a .js file and somehow call it instead of the FP function?
Here is the FP generated code: (it seems to be chocking at the 70 value.
<script Language="JavaScript" Type="text/javascript"><!- -
function FrontPage_Form1_Validator( theForm)
{
if (theForm.Name.value == "")
{
alert("Please enter a value for the \"Name\" field.");
theForm.Name.focus();
return (false);
}
if (theForm.Name.value.length > 70)
{
alert("Please enter at most 70 characters in the \"Name\" field.");
theForm.Name.focus();
return (false);
}
var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXY Zabcdefghi jklmnopqrs tuvwxyzƒŠŒ ŽšœžŸÀÁÂÃÄ ÅÆÇÈÉÊËÌÍÎ ÏÐÑÒÓÔÕÖØÙ ÚÛÜÝÞßàáâã äåæçèéêëìí îïðñòóôõöø ùúûüýþÿ \t\r\n\f";
var checkStr = theForm.Name.value;
var allValid = true;
var validGroups = true;
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
}
if (!allValid)
{
alert("Please enter only letter and whitespace characters in the \"Name\" field.");
theForm.Name.focus();
return (false);
}
if (theForm.EmailAddress.valu e == "")
{
alert("Please enter a value for the \"EmailAddress\" field.");
theForm.EmailAddress.focus ();
return (false);
}
if (theForm.EmailAddress.valu e.length < 5)
{
alert("Please enter at least 5 characters in the \"EmailAddress\" field.");
theForm.EmailAddress.focus ();
return (false);
}
if (theForm.EmailAddress.valu e.length > 35)
{
alert("Please enter at most 35 characters in the \"EmailAddress\" field.");
theForm.EmailAddress.focus ();
return (false);
}
var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXY Zabcdefghi jklmnopqrs tuvwxyzƒŠŒ ŽšœžŸÀÁÂÃÄ ÅÆÇÈÉÊËÌÍÎ ÏÐÑÒÓÔÕÖØÙ ÚÛÜÝÞßàáâã äåæçèéêëìí îïðñòóôõöø ùúûüýþÿ012 3456789-@. \t\r\n\f";
var checkStr = theForm.EmailAddress.value ;
var allValid = true;
var validGroups = true;
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
}
if (!allValid)
{
alert("Please enter only letter, digit, whitespace and \"@.\" characters in the \"EmailAddress\" field.");
theForm.EmailAddress.focus ();
return (false);
}
if (theForm.DaytimePhone.valu e == "")
{
alert("Please enter a value for the \"Daytime Phone\" field.");
theForm.DaytimePhone.focus ();
return (false);
}
if (theForm.DaytimePhone.valu e.length < 5)
{
alert("Please enter at least 5 characters in the \"Daytime Phone\" field.");
theForm.DaytimePhone.focus ();
return (false);
}
if (theForm.DaytimePhone.valu e.length > 12)
{
alert("Please enter at most 12 characters in the \"Daytime Phone\" field.");
theForm.DaytimePhone.focus ();
return (false);
}
var checkOK = "0123456789-()- \t\r\n\f";
var checkStr = theForm.DaytimePhone.value ;
var allValid = true;
var validGroups = true;
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
}
if (!allValid)
{
alert("Please enter only digit, whitespace and \"()-\" characters in the \"Daytime Phone\" field.");
theForm.DaytimePhone.focus ();
return (false);
}
return (true);
}
//--></script>
Can I copy the FP generated javascript to a .js file and somehow call it instead of the FP function?
Here is the FP generated code: (it seems to be chocking at the 70 value.
<script Language="JavaScript" Type="text/javascript"><!-
function FrontPage_Form1_Validator(
{
if (theForm.Name.value == "")
{
alert("Please enter a value for the \"Name\" field.");
theForm.Name.focus();
return (false);
}
if (theForm.Name.value.length
{
alert("Please enter at most 70 characters in the \"Name\" field.");
theForm.Name.focus();
return (false);
}
var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXY
var checkStr = theForm.Name.value;
var allValid = true;
var validGroups = true;
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
}
if (!allValid)
{
alert("Please enter only letter and whitespace characters in the \"Name\" field.");
theForm.Name.focus();
return (false);
}
if (theForm.EmailAddress.valu
{
alert("Please enter a value for the \"EmailAddress\" field.");
theForm.EmailAddress.focus
return (false);
}
if (theForm.EmailAddress.valu
{
alert("Please enter at least 5 characters in the \"EmailAddress\" field.");
theForm.EmailAddress.focus
return (false);
}
if (theForm.EmailAddress.valu
{
alert("Please enter at most 35 characters in the \"EmailAddress\" field.");
theForm.EmailAddress.focus
return (false);
}
var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXY
var checkStr = theForm.EmailAddress.value
var allValid = true;
var validGroups = true;
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
}
if (!allValid)
{
alert("Please enter only letter, digit, whitespace and \"@.\" characters in the \"EmailAddress\" field.");
theForm.EmailAddress.focus
return (false);
}
if (theForm.DaytimePhone.valu
{
alert("Please enter a value for the \"Daytime Phone\" field.");
theForm.DaytimePhone.focus
return (false);
}
if (theForm.DaytimePhone.valu
{
alert("Please enter at least 5 characters in the \"Daytime Phone\" field.");
theForm.DaytimePhone.focus
return (false);
}
if (theForm.DaytimePhone.valu
{
alert("Please enter at most 12 characters in the \"Daytime Phone\" field.");
theForm.DaytimePhone.focus
return (false);
}
var checkOK = "0123456789-()- \t\r\n\f";
var checkStr = theForm.DaytimePhone.value
var allValid = true;
var validGroups = true;
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
}
if (!allValid)
{
alert("Please enter only digit, whitespace and \"()-\" characters in the \"Daytime Phone\" field.");
theForm.DaytimePhone.focus
return (false);
}
return (true);
}
//--></script>
Honestly, I know nothing about JS, I would recommend (I can do it) :) is to delete this question for you, paste this information into the JS TA: https://www.experts-exchange.com/Web/Web_Languages/JavaScript/ and ask them - some really great JS coders there
-Corey
-Corey
ASKER
Hi Corey!
I would greatly appreciate your assistance in moving the question to the JS section.
Thank you in advance.
I would greatly appreciate your assistance in moving the question to the JS section.
Thank you in advance.
make sure your code is between
<script language="javascript">
</script>
tags
<script language="javascript">
</script>
tags
oh, change this line
//--></script>
to this
//-->
</script>
//--></script>
to this
//-->
</script>
ASKER
Hi!
Here is a link to the page that works in IE, but not in NS 7.01.
http://www.topsecurityinc.com/eform.asp
Any ideas why the javascript is being displayed?
Thank you in advance.
Here is a link to the page that works in IE, but not in NS 7.01.
http://www.topsecurityinc.com/eform.asp
Any ideas why the javascript is being displayed?
Thank you in advance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Glad to have helped
Thanks
jAy
Thanks
jAy
-Corey