Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

FronPage Validation does not work

Posted on 2002-05-21
5
Medium Priority
?
208 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
ID: 7024988
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 400 total points
ID: 7028519
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__
ID: 7163522
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
ID: 7164655
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
ID: 8985916
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

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

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

This guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
The purpose of this video is to demonstrate how to update a WordPress Site’s version. WordPress releases new versions of its software frequently and it is important to update frequently in order to keep your site secure, and to get new WordPress…
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…
Suggested Courses

885 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