Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. A simple contact form with validation

A simple contact form with validation

Scheduled Pinned Locked Moved Web Development
javascriptcsssysadmintoolsperformance
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 9253767
    wrote on last edited by
    #1

    Hi I hope somone can help with my dilema I am using this code to load an external page (contact form ) into an ajax panel I have tried several (contact forms) some from this website however when I submit the form I get errors either saying it cannot find the page or it just refreshed to the main default page

    <script type="text/javascript">
    $(document).ready(function () {

        $('#panel1').slidePanel({
            triggerName: '#trigger1',
            
            position: 'fixed',
            triggerTopPos: '475px',
            panelTopPos: '495px',
            ajax: true,
            panelOpacity: 0.8,
                    speed: 'slow',
    
                    clickOutsideToClose: true,
                    ajaxSource: '/ContactUs/Default.aspx'
        });
    });
    

    </script>

    this is the contact form I am trying to use

    <head id="Head1" runat="server">
    <title>Contact Us</title>
    <script src="js/jquery-1.3.2.min.js" type="text/javascript"></script>
    <script src="js/jquery.validate.js" type="text/javascript"></script>
    <script src="js/jquery.blockUI.js" type="text/javascript"></script>
    <script type="text/javascript">
    $.validator.setDefaults({
    submitHandler: function() {
    $.blockUI({
    message: "

    Thank you!

    We'll get in touch with you asap.

    ",
    fadeIn: 500,
    fadeOut: 500,
    timeout: 3000,
    showOverlay: false,
    centerX: true,
    centerY: true,
    css: {
    width: '350px',
    right: '10px',
    border: 'none',
    padding: '5px',
    backgroundColor: '#000',
    '-webkit-border-radius': '10px',
    '-moz-border-radius': '10px',
    opacity: .6,
    color: '#fff'
    }
    });
    this.document.form.submit();
    }
    });

    $().ready(function() {
        // validate the comment form when it is submitted
        $("#contactForm").validate({
            rules: {
                email: {
                    required: true,
                    email: true
                }
            }
        });
    });
    

    </script>
    <

    S 1 Reply Last reply
    0
    • U User 9253767

      Hi I hope somone can help with my dilema I am using this code to load an external page (contact form ) into an ajax panel I have tried several (contact forms) some from this website however when I submit the form I get errors either saying it cannot find the page or it just refreshed to the main default page

      <script type="text/javascript">
      $(document).ready(function () {

          $('#panel1').slidePanel({
              triggerName: '#trigger1',
              
              position: 'fixed',
              triggerTopPos: '475px',
              panelTopPos: '495px',
              ajax: true,
              panelOpacity: 0.8,
                      speed: 'slow',
      
                      clickOutsideToClose: true,
                      ajaxSource: '/ContactUs/Default.aspx'
          });
      });
      

      </script>

      this is the contact form I am trying to use

      <head id="Head1" runat="server">
      <title>Contact Us</title>
      <script src="js/jquery-1.3.2.min.js" type="text/javascript"></script>
      <script src="js/jquery.validate.js" type="text/javascript"></script>
      <script src="js/jquery.blockUI.js" type="text/javascript"></script>
      <script type="text/javascript">
      $.validator.setDefaults({
      submitHandler: function() {
      $.blockUI({
      message: "

      Thank you!

      We'll get in touch with you asap.

      ",
      fadeIn: 500,
      fadeOut: 500,
      timeout: 3000,
      showOverlay: false,
      centerX: true,
      centerY: true,
      css: {
      width: '350px',
      right: '10px',
      border: 'none',
      padding: '5px',
      backgroundColor: '#000',
      '-webkit-border-radius': '10px',
      '-moz-border-radius': '10px',
      opacity: .6,
      color: '#fff'
      }
      });
      this.document.form.submit();
      }
      });

      $().ready(function() {
          // validate the comment form when it is submitted
          $("#contactForm").validate({
              rules: {
                  email: {
                      required: true,
                      email: true
                  }
              }
          });
      });
      

      </script>
      <

      S Offline
      S Offline
      StianSandberg
      wrote on last edited by
      #2

      Remember that the file which loads the contactform has to be in the same folder as your Contacts.ashx. Or else it won't work (404, file not found) If it's not in the same path/folder you have to change the action-attribute in the form-tag.

      -------------------- When Chuck Norris' dreams come true, your worst nightmares begin.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups