Form Validation - Error Message (Full Version)

All Forums >> [Web Development] >> Microsoft FrontPage Help



Message


JonF -> Form Validation - Error Message (8/14/2003 16:54:57)

Hello from England,

I've just joined this forum - and I hope someone can help me. I've been using FP for a while, but have run up against two questions. Here's one of them (other one posted separately):

> I have a form which requires the user to tick a box to indicate that they accept my terms and conditions. If they do not tick this box, they get a standard error message - my question is, can I edit this error message?

I think I am correct in saying that this is NOT the confirmation page - I already have the comfirmation page which the user sees when they have correctly submitted the form - and I am clear on how to edit this.

The page I am struggling with is the one that is generated when the form fails the "validation test". It looks to me that I just have to accept the standard FP error message. Is this correct?

(The reason for my particular concern is that I have just built a German language site, and the user currently sees an error message in English - which they won't understand.)

Thanks in advance for any help!
JonF




wattle -> RE: Form Validation - Error Message (8/14/2003 20:53:03)

Hi Jon, I don't think you can edit the standard Frontpage message [>:]

I've used javascript for this - quite easy to edit the message in the script.

Here are a few Javascript form links that may give you some ideas:

http://javascript.internet.com/forms/accept-terms.html
http://javascript.internet.com/forms/agree-before-entry.html
http://javascript.internet.com/forms/basic-validation.html
http://javascript.internet.com/forms/val-cookie.html

If you would like to look at all the form scripts go to http://javascript.internet.com/forms/

http://www.javascriptkit.com is also good.

If you do use a script, when you copy it, paste it into a text editor like Notepad, and then copy it from there to paste into your html. You probably already know this but I do occasionally forget and wonder why things get messy [&:]




JonF -> RE: Form Validation - Error Message (8/15/2003 9:43:31)

Thanks wattle, I will take a look at these now.
JonF




Spooky -> RE: Form Validation - Error Message (8/15/2003 16:28:11)

Hi Jon and welcome!
You can manually edit the code created by FP.

If you make a simple form, it looks like this :

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
</head>

<body>

<form method="POST" action="--WEBBOT-SELF--" onsubmit="return FrontPage_Form1_Validator(this)" language="JavaScript" name="FrontPage_Form1">
  <!--webbot bot="SaveResults" u-file="_private/form_results.csv" s-format="TEXT/CSV" s-label-fields="TRUE" startspan --><input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--webbot bot="SaveResults" endspan i-checksum="43374" --><p>
  <!--webbot bot="Validation" b-value-required="TRUE" --><input type="text" name="T1" size="20"><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>

</body>

</html>


If you close this, then choose to open it in notepad, youll see different code :

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
</head>

<body>

<!--webbot BOT="GeneratedScript" PREVIEW=" " startspan --><script Language="JavaScript" Type="text/javascript"><!--
function FrontPage_Form1_Validator(theForm)
{

  if (theForm.T1.value == "")
  {
    alert("Please enter a value for the \"T1\" field.");
    theForm.T1.focus();
    return (false);
  }
  return (true);
}
//--></script><!--webbot BOT="GeneratedScript" endspan --><form method="POST" action="_vti_bin/shtml.dll/new_page_1.htm" onsubmit="return FrontPage_Form1_Validator(this)" language="JavaScript" name="FrontPage_Form1" webbot-action="--WEBBOT-SELF--">
  <!--webbot bot="SaveResults" U-File="_private/form_results.csv" S-Format="TEXT/CSV" S-Label-Fields="TRUE" startspan --><input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--webbot bot="SaveResults" i-checksum="43374" endspan --><p>
  <!--webbot bot="Validation" B-Value-Required="TRUE" --><input type="text" name="T1" size="20"><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>

</body>

</html>


As you see - the javascript error is now clear in the body.
However, to edit the code, you cannot have the web bot as it will overwrite any changes.

Remove the validation specific code (in notepad) and resave it :

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
</head>

<body>

<script Language="JavaScript" Type="text/javascript"><!--
function FrontPage_Form1_Validator(theForm)
{

  if (theForm.T1.value == "")
  {
    alert("Please enter a value for the \"T1\" field.");
    theForm.T1.focus();
    return (false);
  }
  return (true);
}
//--></script>

<form method="POST" action="_vti_bin/shtml.dll/new_page_1.htm" webbot-action="--WEBBOT-SELF--">
  <!--webbot bot="SaveResults" U-File="_private/form_results.csv" S-Format="TEXT/CSV" S-Label-Fields="TRUE" startspan --><input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--webbot bot="SaveResults" i-checksum="43374" endspan --><p>
  <input type="text" name="T1" size="20"><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>

</body>

</html>




arturo -> RE: Form Validation - Error Message (8/19/2003 14:11:36)

i thought i saw a url validation failure page in FP2002. i think it's form properties, options, confirmation page and there is a place for the url for a form validation failure page. i might be wrong...i'll check it out too....




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.046875