JavaScript Form Validation
The normal form field validation that was in FrontPage is not in
Expression Web, unfortunately. The only validation available is with the
ASP.Net validation controls, which aren't of use with normal html form fields.
Although it's possible to hand code the validation, you can open the
form page in FP and add the validation there. You can then open the page in
EW and the validation 'Bot' will still work.
What I often do though is preview the page in a browser, view the source,
and then copy it over the original page code. This gives me the
JavaScript that the FP Bot generates and allows me to edit the somewhat
unhelpful messages it produces.
When you preview the page and copy the code you'll see something like
this:
<script Language="JavaScript" Type="text/javascript">
<!--
function FrontPage_Form1_Validator(theForm) {
if (theForm.txtName.value == "") {
alert("Please enter a value for the \"Name\" field.");
theForm.txtName.focus();
return (false); }
return (true); }
//-->
</script>
The error message can easily be changed by altering the 'alert' text to
something more meaningful, eg:
alert("Please enter your full name.");
Using FP like this to generate the code is not an ideal solution but it's
easier than hand coding or using some other tool.