Results 1 to 4 of 4

Hybrid View

  1. #1
    Join Date
    Aug 2011
    Posts
    2
    Plugin Contributions
    0

    Default Java script form in ezpages?

    Hello im new to this forum so i appologise if this post is in the wrong place, i have been spending many hours trying to get some javascript working on the ez pages and trolling this forum i have found that i needed the jscript_(filename).js to be included in /includes/templates/YOUR_template/jscript file to be called before the </head>

    but now i need to add some script after a form element in the body section.

    Code:
    <form id="myform" action="new_account_online.php"> 
    <table border="0">
    <tbody>
    <tr>
    <td colspan="2"><strong>Invoice Details</strong></td>
    </tr>
    <tr>
    <td>Full Name:<span style="color: #ff0000;">*</span></td>
    <td><input id="full_name" name="full_name" type="text" /></td>
    </tr>
    //code removed to save space
    <tr>
    <td>Please confirm you agree to the terms and conditions<span style="color: #ff0000;">*</span></td>
    <td><input id="confirm_tc" name="confirm_tc" type="checkbox" /></td>
    </tr>
    <tr>
    <td colspan="2" align="center"><input type="submit" name="submit" /><A href="javascript: submitform()">Submit</A></td>
    </tr>
    </tbody>
    </table>
    </form>
    
    <!-- validation script -->
    <script  type="text/javascript">
     var frmvalidator = new Validator("myform");
     frmvalidator.addValidation("full_name","req","Please enter your Name");
     frmvalidator.addValidation("T_A_L1","req", "Please enter the first line of your address");
     frmvalidator.addValidation("T_A_postcode","req","Please enter your postcode");
     frmvalidator.addValidation("T_A_email","req","Please enter your Email address");
     frmvalidator.addValidation("T_A_email","email");
     frmvalidator.addValidation("T_A_phone","req","Please enter your phone number");
     frmvalidator.addValidation("T_A_phone","maxlen=50");
     frmvalidator.addValidation("T_A_phone","numeric");
     frmvalidator.addValidation("cust_class","dontselect="ps");
     frmvalidator.addValidation("confirm_tc","shouldselchk=on","Please confirm the Terms & Conditions");
    </script>
    <!-- end validation script -->
    <!-- submit script -->
    <script type="text/javascript">
    function submitform()
    {
      if(document.myform.onsubmit())
      {
        document.myform.submit();
      }
    }
    </script>
    <!-- end submit script -->
    when i try and run this the script it does not seem to be getting executed.

    do i need to add the script into another .js file and call it within the ez pages or something like that?


    regards
    thanks in advance as this is really driving me crazy

  2. #2

    Default Re: Java script form in ezpages?

    Quote Originally Posted by TheLangerGroup View Post
    Hello im new to this forum so i appologise if this post is in the wrong place, i have been spending many hours trying to get some javascript working on the ez pages and trolling this forum i have found that i needed the jscript_(filename).js to be included in /includes/templates/YOUR_template/jscript file to be called before the </head>

    but now i need to add some script after a form element in the body section.

    Code:
    <form id="myform" action="new_account_online.php"> 
    <table border="0">
    <tbody>
    <tr>
    <td colspan="2"><strong>Invoice Details</strong></td>
    </tr>
    <tr>
    <td>Full Name:<span style="color: #ff0000;">*</span></td>
    <td><input id="full_name" name="full_name" type="text" /></td>
    </tr>
    //code removed to save space
    <tr>
    <td>Please confirm you agree to the terms and conditions<span style="color: #ff0000;">*</span></td>
    <td><input id="confirm_tc" name="confirm_tc" type="checkbox" /></td>
    </tr>
    <tr>
    <td colspan="2" align="center"><input type="submit" name="submit" /><A href="javascript: submitform()">Submit</A></td>
    </tr>
    </tbody>
    </table>
    </form>
    
    <!-- validation script -->
    <script  type="text/javascript">
     var frmvalidator = new Validator("myform");
     frmvalidator.addValidation("full_name","req","Please enter your Name");
     frmvalidator.addValidation("T_A_L1","req", "Please enter the first line of your address");
     frmvalidator.addValidation("T_A_postcode","req","Please enter your postcode");
     frmvalidator.addValidation("T_A_email","req","Please enter your Email address");
     frmvalidator.addValidation("T_A_email","email");
     frmvalidator.addValidation("T_A_phone","req","Please enter your phone number");
     frmvalidator.addValidation("T_A_phone","maxlen=50");
     frmvalidator.addValidation("T_A_phone","numeric");
     frmvalidator.addValidation("cust_class","dontselect="ps");
     frmvalidator.addValidation("confirm_tc","shouldselchk=on","Please confirm the Terms & Conditions");
    </script>
    <!-- end validation script -->
    <!-- submit script -->
    <script type="text/javascript">
    function submitform()
    {
      if(document.myform.onsubmit())
      {
        document.myform.submit();
      }
    }
    </script>
    <!-- end submit script -->
    when i try and run this the script it does not seem to be getting executed.

    do i need to add the script into another .js file and call it within the ez pages or something like that?


    regards
    thanks in advance as this is really driving me crazy
    It seems that Java is reaaly hard. Some many questions and few people can understand. I also have a very disgusting Java problem

  3. #3
    Join Date
    Dec 2009
    Location
    Amersfoort, The Netherlands
    Posts
    2,845
    Plugin Contributions
    25

    Default Re: Java script form in ezpages?

    If I remember well, you need to use just the ID number of the ez page instead of a file name to make it work.

  4. #4
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,266
    Plugin Contributions
    3

    Default Re: Java script form in ezpages?

    Why don't you go get MachForm by Appnitro and use that instead. FAR easier and very quick to install on your server.

    You can create very complex forms and embed them in any page in under 5 minutes.

    We use it HERE.
    20 years a Zencart User

 

 

Similar Threads

  1. Java Script problem..
    By fatum112 in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 24 May 2006, 06:21 AM

Posting Permissions

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