Solved

FronPage Validation does not work

Posted on 2002-05-21
5
196 Views
Last Modified: 2013-12-24
Hi,

I added validation in FrontPage but I do not see it working.  FrontPage added some webbot and it is commented out.

I did TextBoxValidation/datatype=integer->Datavalue...

How do I add simple validation?  

<!--webbot bot="Validation" S-Display-Name="foooo"
    S-Data-Type="Integer" S-Number-Separators="x" B-Value-Required="TRUE"
    I-Minimum-Length="1" I-Maximum-Length="3"
    S-Validation-Constraint="Greater than or equal to" S-Validation-Value="-35"
    S-Validation-Constraint="Less than or equal to" S-Validation-Value="35" --><input name="duplex_margin" size="3" value="0" maxlength="3">  
    (-35..35)
0
Comment
Question by:akoifman
5 Comments
 
LVL 19

Expert Comment

by:webwoman
Comment Utility
Make your own. There are lots of them, they work much better than what FP tries to do.

Go to www.javascriptsource.com see what they have. You WILL need to modify it, and you WILL need to make sure you use it correctly, have it in the right spot, etc. If you're not comfortable editing your code, this is a good time to learn. ;-)

Because like it or not, FrontPage doesn't do lots of things. Some things it does, but badly. If you learn how it's doing what it does (or doesn't do), you can force it to do what YOU want instead of what IT wants. ;-)
0
 
LVL 1

Accepted Solution

by:
raid999 earned 100 total points
Comment Utility
This is a the JAVAScript that will check on the form bellow:

<script type="text/javascript">
<!--
function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_validateForm() { //v3.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (val!=''+num) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}


//-->
</script>

And this is the form:

                  <form action="../servlet/UpdateProfileServlet" onSubmit="MM_validateForm('name','','R','surname','','R','address1','','R','E-mail','','RisEmail','city','','R','post_code','','R','ccard_number','','R');return document.MM_returnValue" method="post">
                    <table align="center">
                      <tr>
                        <td><span class="ntext">Name</span></td>
                        <td>*</td>
                        <td>
                          <input name="name" type="text" maxlength="20" size="20" value="<%=name%>" >
                        </td>
                      </tr>
                      <tr>
                        <td><span class="ntext">Address 1</span></td>
                        <td>*</td>
                        <td>
                          <input name="address1" type="text" maxlength="20" size="20" value="<%=adr1%>" >
                        </td>
                      </tr>
                                <tr>
                        <td><span class="ntext">Address 2</span></td>
                        <td>*</td>
                        <td>
                          <input name="address2" type="text" maxlength="20" size="20" value="<%=adr2%>" >
                        </td>
                      </tr>
                      <tr>
                        <td><span class="ntext">E-mail</span></td>
                        <td>*</td>
                        <td>
                          <input name="email" type="text" maxlength="20" size="20" value="<%=email%>" >
                        </td>
                      </tr>
                     
                      <tr>
                        <td><span class="ntext">Telephone</span></td>
                        <td>*</td>
                        <td>
                          <input name="telephone" type="text" maxlength="20" size="20" value="<%=phone%>" >
                        </td>
                                     <tr>
                        <td><span class="ntext">Password</span></td>
                        <td>*</td>
                        <td>
                          <input name="password" type="password" maxlength="20" size="20" value="<%=pw%>" >
                        </td>
                      </tr>
                     
                      <tr>
                        <td><span class="ntext">Credit Card Type</span></td>
                        <td>*</td>
                        <td> <span class="ntext">
                          <select name="ccard_type" size="1">
                            <option selected value=<%=creditcardtype%>><%=creditcardtype%></option>
                            <option value="VISA">VISA
                            <option value="American Express">American Express
                            <option value="Switch">Switch
                            <option value="Master Card">Master Card
                          </select></span>
                        </td>
                      </tr>
                      <tr>
                        <td><span class="ntext">Credit Card Number</span></td>
                        <td>*</td>
                        <td>
                          <input name="ccard_number" type="text" maxlength="16" size="16" value="<%=credit_card%>" >
                        </td>
                      </tr>
                                <tr>
                        <td><span class="ntext">Credit Card Expiry Date</span></td>
                        <td>*</td>
                        <td>
                          <input name="expiry_date" type="text" maxlength="16" size="16" value="<%=validDate%>" >
                        </td>
                      </tr>
                      <tr>
                        <td colspan=3><span class="ntext">( Fields marked with "*" are compulsory.)</span></td>
                      </tr>
                      <tr>
                        <td colspan=3>
                          <p align="center">
                            <input type="submit" value="Update Profile">
                        </td>
                      </tr>
                    </table>
                  </form>
0
 
LVL 1

Expert Comment

by:__Holly__
Comment Utility
so i c that webwoman is out talking smack about frontpage again...

oh so surprising..

you guys know that she works for the marketing department of macromedia; right??

she gets paid to sit around and talk smack about frontpage all day..

0
 
LVL 19

Expert Comment

by:webwoman
Comment Utility
I wish... you DO notice all the 'I did this in FP and it's not working' messages here, don't you?

FrontPage would be a very nice tool if it worked as advertised. It doesn't. That's not me -- that's all the people here saying that. THEY'RE the ones posting the 'how do I fix this, I did it in FP *AND IT'S NOT WORKING*' messages.

I know enough to FORCE it to do what I want. I got tired of fighting with the software and moved to something else.

FWIW, I don't particularly like DW either -- I'd much rather use HomeSite, so *I* control what's getting generated.

If you know another way to make it work, please let this poor person know. The javascript routine will work, as opposed to FP. ;-)
0
 
LVL 29

Expert Comment

by:coreybryant
Comment Utility
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Accept raid999's comment as answer
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

coreybryant
EE Cleanup Volunteer
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article provides a case study on how our local youth baseball league deployed a new website, including the platform selection, implementation and benefits to the league.
Introduction In this tutorial, I'll explain how to create an animated progress meter in a wireframe prototype developed using Axure RP 7.0 - a leading prototyping tool for designing web sites and software. (For more information about Axure and gett…
The purpose of this video is to demonstrate how to connect a WordPress website to Google Analytics. This will be demonstrated using a Windows 8 PC Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php :…
The purpose of this video is to demonstrate how to insert an Iframe into WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Open Page or Post…

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now