dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: [RESOLVED] Multistage form resets to start

  1. #1
    Join Date
    Sep 2013
    Posts
    8

    resolved [RESOLVED] Multistage form resets to start

    I'm working on a multistage form . The problem is that it wont get past the 3rd stage . If you click continue it resets back to the start.

    Here is a like to the page on my server - http://www.mk18.co.uk/test

    I have a feeling its probably to do with the java script , but at one point it did work.

    You can view the full page code by viewing the source.

    EDIT : Variables valid1 and valid2 are defined , the probelm seems to be in the processPhase3() function

    EDIT 2 : I changed the if (valid1 && valid2) in processPhase3 to if(email.length > 1){ to make sure it wasnt the valid1 / 2 causing the problem. It now lets me through , but then takes me to step one after step 4 has loaded.

    Function :

    Code:
    function processPhase3() {
    var tele = document.getElementById("Ctelephone");
    var pattern2 = tele.getAttribute("pattern2");
    var re1 = new RegExp(pattern2);     
    var valid1 = re1.test(tele.value);
    if (valid1) {
    //alert("matches phone!")
    } else {
    //alert("pattern doesn't match...")
    }
    
    var mail = document.getElementById("Cemail");
    var pattern3 = mail.getAttribute("pattern3");
    var re2 = new RegExp(pattern3);     
    var valid2 = re2.test(mail.value);
    if (valid2) {
    //alert("matches email!")
    } else {
    //alert("pattern doesn't match...")
    }
    
    phone = _("Ctelephone").value;
    mobile = _("Cmobile").value;
    email = _("Cemail").value;
    if (valid1 && valid2) { // This is a test to make sure its not the valid1 and valid2 doing it. Partly true
    _("phase3").style.display = "none";
    _("phase4").style.display = "block";
    _("progressBar").value = 99;
    _("status").innerHTML = "Step 4";
    } else {
    
    }
    }

  2. #2
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    2,595
    You need to supply your HTML and JavaScript and any error messages from the JavaScript console
    If your post falls off the page, bump it. ...
    Please remember to wrap any code you have in forum tags:-

    [CODE]...[/CODE] [HTML]...[/HTML] [PHP]...[/PHP]

    If you can't think outside the box, you will be trapped forever with no escape...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles