Solved

Frontpage 2003 generated form validation javascript is shown in NS 7.01

Posted on 2004-09-09
10
1,466 Views
Last Modified: 2012-05-05
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.
0
Comment
Question by:TrueBlue
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
10 Comments
 
LVL 29

Expert Comment

by:coreybryant
ID: 12017490
That part seems correct.  Have you considered writing your own JS to verify the input fields?

-Corey
0
 

Author Comment

by:TrueBlue
ID: 12018067
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 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ \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.value == "")
  {
    alert("Please enter a value for the \"EmailAddress\" field.");
    theForm.EmailAddress.focus();
    return (false);
  }

  if (theForm.EmailAddress.value.length < 5)
  {
    alert("Please enter at least 5 characters in the \"EmailAddress\" field.");
    theForm.EmailAddress.focus();
    return (false);
  }

  if (theForm.EmailAddress.value.length > 35)
  {
    alert("Please enter at most 35 characters in the \"EmailAddress\" field.");
    theForm.EmailAddress.focus();
    return (false);
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ0123456789-@. \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.value == "")
  {
    alert("Please enter a value for the \"Daytime Phone\" field.");
    theForm.DaytimePhone.focus();
    return (false);
  }

  if (theForm.DaytimePhone.value.length < 5)
  {
    alert("Please enter at least 5 characters in the \"Daytime Phone\" field.");
    theForm.DaytimePhone.focus();
    return (false);
  }

  if (theForm.DaytimePhone.value.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>
0
 
LVL 29

Expert Comment

by:coreybryant
ID: 12018526
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: http://www.experts-exchange.com/Web/Web_Languages/JavaScript/ and ask them - some really great JS coders there

-Corey
0
The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

 

Author Comment

by:TrueBlue
ID: 12019595
Hi Corey!

I would greatly appreciate your assistance in moving the question to the JS section.

Thank you in advance.

0
 
LVL 15

Expert Comment

by:justinbillig
ID: 12019951
make sure your code is between

<script language="javascript">

</script>

tags
0
 
LVL 15

Expert Comment

by:justinbillig
ID: 12019963
oh, change this line

//--></script>

to this

//-->
</script>
0
 

Author Comment

by:TrueBlue
ID: 12022345
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.
0
 
LVL 16

Accepted Solution

by:
jaysolomon earned 500 total points
ID: 12023448
<html>
<head>
<title></title>
<script type="text/javascript">
<!--
function validateForm(theForm)
{
      var isPhone = /^\([1-9]\d{2}\)\s?\d{3}\-\d{4}$/; // (000)000-0000 or (000) 000-0000
      var isEmail = /^[a-z][a-z0-9]*([.\-_][a-z][a-z0-9]*)*@([a-z][a-z0-9]*.)*([a-z]{2}|com|net|org|biz|gov|pro|int|mil|edu|info|name|aero|coop|museum)$/i;
      if(theForm.Name.value.split(" ").join("") == "")
      {
            alert("Please enter your Name.");
            theForm.Name.select();
            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);
      }
      if(theForm.EmailAddress.value.split(" ").join("") == "")
      {
            alert("Please enter a Email Address.");
            theForm.EmailAddress.select();
            theForm.EmailAddress.focus();
            return (false);
      }
      if (!isEmail.test(theForm.EmailAddress.value))
      {
          alert("The Email Address is NOT in the corect format.");
          theForm.EmailAddress.focus();
          return (false);
      }
       if (theForm.EmailAddress.value.length > 35)
        {
          alert("Please enter at most 35 characters in the Email Address field.");
          theForm.EmailAddress.focus();
          return (false);
        }
      if (theForm.DaytimePhone.value.split(" ").join("") == "")
      {
            alert("Please enter a Daytime Phone Number.");
            theForm.DaytimePhone.select();
            theForm.DaytimePhone.focus();
            return (false);
      }
      if (!isPhone(theForm.DaytimePhone.value))
      {
            alert("The Phone Number is NOT in the correct format:\n...(000)000-0000 or (000) 000-0000.");
            theForm.DaytimePhone.focus();
            return (false);
      }
      if (theForm.DaytimePhone.value.length > 14)
      {
            alert("Please enter at most 14 characters in the \"Daytime Phone\" field.");
            theForm.DaytimePhone.focus();
            return (false);
      }
      return (true);
}
// -->
</script>
</head>
<body>
<form name="form1" method="post" action="" onsubmit="return validateForm(this);">
<input type="text" name="Name">
<input type="text" name="EmailAddress">
<input type="text" name="DaytimePhone">
<input type="submit" name="Submit" value="Submit">
</form>
</body>
</html>
0
 
LVL 16

Expert Comment

by:jaysolomon
ID: 12036560
Glad to have helped

Thanks
jAy
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question