SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Feb 2005
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Validate data in form and combine variables

    I have a form that I am using to page people. I have several fields created, so that I can insure that users enter all the different fields instead of just having a message box. I am using skytel to page the people. I am not an expert in java scripting. I have created a script, but can't get everything to work properly. I have a function created that will take all the values from the fields and put them into one. I also have a javascript that does data validation. The only problem is that they only work independently- I can't seem to get both of them to work. If anyone is interested in assisting, I will include the entire HTML file(about 80 lines), but thought I would ask for assistance first.
    Thanks in advance- Dennis

  2. #2
    SitePoint Member
    Join Date
    Feb 2005
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Actual HTML and Java Script

    OK- here is the actual html that I was talking about - this one does the validation, but the function doesn't take all the values and put them into message
    HTML Code:
    <html>
    
    
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>New Page 1</title>
    <script language="JavaScript" src="gen_validatorv2.js" type="text/javascript"></script>
    
    </head>
    
    <script language="JavaScript"><!--
    function textBuild() {
         document.formName.message.value =  document.formName.m1.value + ' ' + document.formName.m2.value + ' ' + document.formName.m3.value + ' ' + document.formName.m4.value + ' ' + document.formName.m5.value + ' ' + document.formName.m6.value;
    }
    //--></script>
    
    <body>
    <FORM Name="formName" ACTION="http://www.skytel.com/Paging/page.cgi" onSubmit="textBuild()">
    
    
    <p align="left">
    <INPUT TYPE=hidden NAME="pager" VALUE="1">
    <INPUT TYPE=hidden NAME="to" VALUE=888888888>
    <input type="hidden" name="message">
    <table cellspacing="2" cellpadding="2" border="0">
    <tr>
        <td align="right"><font color="#FF0000">* </font>&nbsp;Name</td>
        <td><input type="text" name="m1"></td>
    </tr>
    <tr>
        <td align="right"><font color="#FF0000">* </font>Phone</td>
        <td><input type="text" name="m2"></td>
    </tr>
    <tr>
        <td align="right"><font color="#FF0000">* </font>EA Release</td>
        <td><input type="text" name="m3"></td>
    </tr>
    <tr>
        <td align="right"><font color="#FF0000">* </font>Environment</td>
        <td><input type="text" name="m4"></td>
    </tr>
    <tr>
        <td align="right">Error Message</td>
        <td><input type="text" name="m5" ></td>
    </tr>
    <tr>
        <td align="right"><font color="#FF0000">* </font>Description</td>
        <td><textarea cols="67" rows="5" name="m6"></textarea></td>
    </tr>
    <tr>
        <td align="right"></td>
        <td><input type="submit" value="Submit">       <INPUT TYPE=RESET VALUE="Clear Values">
    </td>
    </tr>
    <tr>
        <td align="right"></td>
        <td>
    </td>
    </tr>
    <tr>
        <td align="right"></td>
        <td><font color="#FF0000">* </font>Required Fields
    </td>
    </tr>
    </table>
    
    </form>
    <script language="JavaScript" type="text/javascript"> <!--
    
     var frmvalidator  = new Validator("formName");
      frmvalidator.addValidation("m1","req","Please enter your Name");
      frmvalidator.addValidation("m1","maxlen=30","Max length for name is 30");
      frmvalidator.addValidation("m1","alpha");
      
      frmvalidator.addValidation("m2","req","Please enter your Phone Number");
      frmvalidator.addValidation("m2","maxlen=14","Max length for phone is 20");
      
      frmvalidator.addValidation("m3","req","Please enter EA Release");
      frmvalidator.addValidation("m3","maxlen=15","Max length for EA Release is 15"); 
      
      frmvalidator.addValidation("m4","req","Please enter the environment");
      frmvalidator.addValidation("m4","maxlen=15","Max length for environment is 15");  
      
      frmvalidator.addValidation("m5","maxlen=80","Max length for environment is 80");
      
      frmvalidator.addValidation("m6","req","Please enter Description");
      frmvalidator.addValidation("m6","maxlen=240","Max length for Description is 180"); 
      
    //--></script>
    
    
    
    
    </body>
    
    
    
    
    
    
    
    
    
    
    
    
    


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •