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

Thread: Problem adapting Sing Up form from Social Network (Adam Khoury), to my page....

  1. #1
    Join Date
    May 2013
    Posts
    14

    Arrow Problem adapting Sing Up form from Social Network (Adam Khoury), to my page....

    I've been trying to adapt the code from lesson 6 (Sign up form) of How to build a Social Network Website from Adam Khoury... I change all the variable acording to the one I'm using but the javascript don't work 'cos don't call to check neither call the php section . can any tell me what I'm doing wrong...

    I cannot post the code 'cos is to long so any that can help me tell me where to send it so you can check it...

    thnaks in advance for the help

  2. #2
    Join Date
    Jul 2013
    Posts
    66
    I'm new to this particular forum, but in general, people do not like these kind of questions. You ought to post your code and if it is a lot of code, condense it down to the minimum code needed to reproduce the actual problem. This is an important step in the process of learning to develop software anyway, so you may wanna get on that as soon as possible. A good starting point would be to get comfortable with the developer tools browsers like Chrome or Firefox offer you, as it is very likely that the browser's developer's console might have some errors or warnings you should look into to trace the problem.

  3. #3
    Join Date
    May 2013
    Posts
    14
    Hi... here is the code

    ?>
    function restrict(elem){
    var tf = _(elem);
    var rx = new RegExp;
    if(elem == "InvoiceToAddress_Email"){
    rx = /[' "]/gi;
    } else if(elem == "InvoiceToAddress_Username"){
    rx = /[^a-z0-9]/gi;
    }
    tf.value = tf.value.replace(rx, "");
    }

    function emptyElement(x){
    _(x).innerHTML = "";
    }

    function checkusername(){
    var u = _("InvoiceToAddress_Username").value;
    if(u != ""){
    _("unamestatus").innerHTML = 'checking ...';
    var ajax = ajaxObj("POST", "signup.php");
    ajax.onreadystatechange = function() {
    if(ajaxReturn(ajax) == true) {
    _("unamestatus").innerHTML = ajax.responseText;
    }
    }
    ajax.send("usernamecheck="+u);
    }
    }
    function signup(){
    var f = _("InvoiceToAddress_FirstName").value;
    var l = _("InvoiceToAddress_LastName").value;
    var s = _("InvoiceToAddress_Street").value;
    var c = _("InvoiceToAddress_City").value;
    var ct = _("InvoiceToAddress_Country").value;
    var e = _("InvoiceToAddress_Email").value;
    var ph = _("InvoiceToAddress_PhoneHome").value;
    var mo = _("InvoiceToAddress_Mobile").value;
    var bd = _("InvoiceToAddress_BirthdateD").value;
    var bm = _("InvoiceToAddress_BirthdateM").value;
    var by = _("InvoiceToAddress_BirthdateY").value;
    var u = _("InvoiceToAddress_Username").value;
    var p1 = _("InvoiceToAddress_Password").value;
    var p2 = _("InvoiceToAddress_ConfirmPss").value;
    var status = _("status");
    if(f == "" || l == "" || s == "" || c == "" || ct== "" || e == "" || ph == "" || mo == "" || bd == "" || bm == "" || by == "" || u == "" || p1 == ""){
    status.innerHTML = "Llene todos los campos requeridos";
    } else if(p1 != p2){
    status.innerHTML = "Your password fields do not match";
    } else if(e1 != e2){
    status.innerHTML = "Your password fields do not match";
    } else {
    _("btn-process").style.display = "none";
    status.innerHTML = 'por favor espere ...';
    var ajax = ajaxObj("POST", "signup.php");
    ajax.onreadystatechange = function() {
    if(ajaxReturn(ajax) == true) {
    if(ajax.responseText != "signup_success"){
    status.innerHTML = ajax.responseText;
    _("btn-process").style.display = "block";
    } else {
    window.scrollTo(0,0);
    _("InvoiceToAddress_signupform").innerHTML = "OK "+u+", check your email inbox and junk mail box at <u>"+e+"</u> in a moment to complete the sign up process by activating your account. You will not be able to do anything on the site until you successfully activate your account.";
    }
    }
    }
    ajax.send("u="+u+"&f="+f+"&l="+l+"&s="+s+"&c="+c+"&ct="+ct+"&e="+e+"&ph="+ph+"&mo="+mo+"&bd="+bd+"&b m="+bm+"&by="+by+"&p="+p1);
    }
    }
    </script>


    <div class="col-main">
    <span>CREAR UNA NUEVA CUENTA</span>
    <div class="sub-leftcol altsize">
    <h2 class="lined"><span>DIRECCIÓN DE FACTURACIÓN / ENVÍO</span></h2>
    <p> Por favor de llenar todos los espacios con (*).</p>
    <form id="InvoiceToAddress_signupform" name="InvoiceToAddress_signupform" onsubmit="return false;">
    <fieldset>
    <div class="form-row required-field">
    <div class="label-cell">
    <label for="InvoiceToAddress_FirstName">Nombre
    <span class="required" title="Campo requerido">*</span>
    </label>
    </div>
    <input id="InvoiceToAddress_FirstName" type="text" onfocus="emptyElement('status')" name="InvoiceToAddress_FirstName" class="text" title="Por favor introduzca su nombre."maxlenght="15" />
    </div>
    <div class="form-row required-field">
    <div class="label-cell">
    <label for="InvoiceToAddress_LastName">Apellido
    <span class="required" title="Campo obligatorio">*</span>
    </label>
    </div>
    <input id="InvoiceToAddress_LastName" type="text" onfocus="emptyElement('status')" name="InvoiceToAddress_LastName" class="text" value title="Por favor introduzca su apellido."maxlenght="35" />
    </div>
    <div class="form-row required-field">
    <div class="label-cell">
    <label for="InvoiceToAddress_Street">Calle/ N
    <span class="required" title="Campo obligatorio">*</span>
    </label>
    </div>
    <input id="InvoiceToAddress_Street" type="text" onfocus="emptyElement('status')" name="InvoiceToAddress_Street" class="text" value title="Por favor introduzca su calle / numero."maxlenght="50" />
    </div>
    <div class="form-row required-field">
    <div class="label-cell">
    <label for="InvoiceToAddress_City">Ciudad</label>
    </div>
    <input id="InvoiceToAddress_City" type="text" onfocus="emptyElement('status')" name="InvoiceToAddress_City" class="text" value title="Por favor introduzca su calle / numero."maxlenght="40" />
    </div>
    <div class="form-row required-field">
    <div class="label-cell">
    <label for="InvoiceToAddress_Country">Pais</label>
    </div>
    <input id="InvoiceToAddress_Country" type="text" name="InvoiceToAddress_Country" class="text disabled-text" value="Republica Dominicana" disabled="disabled" />
    <input type="hidden" name="InvoiceToAddressForm_Country" value="Republica Dominicana">
    <input type="hidden" name="InvoiceToAddressForm_CountryCode" id="InvoiceToAddressForm_CountryCode" value="RD">
    </div>
    <div class="form-row required-field">
    <div class="label-cell">
    <label for="InvoiceToAddress_Email">Correo electronico</label>
    </div>
    <input id="InvoiceToAddress_Email" type="text" onfocus="emptyElement('status')" onkeyup="restrict('InvoiceToAddress_Email')" name="InvoiceToAddress_Email" class="text" value title="Por favor introduzca su calle / numero."maxlenght="70" data-inputtype-"email"/>
    </div>
    <div class="form-row required-field">
    <div class="label-cell">
    <label for="InvoiceToAddress_PhoneHome">Telefono Residencia</label>
    </div>
    <input id="InvoiceToAddress_PhoneHomeAC" type="text" onfocus="emptyElement('status')" name="InvoiceToAddress_PhoneHomeAC" class="text date hint" size="3" maxlenght="3" value placeholder="" />
    <input id="InvoiceToAddress_PhoneHome" type="text" onfocus="emptyElement('status')" name="InvoiceToAddress_PhoneHomet" class="text" value title="Por favor introduzca su calle / numero."maxlenght="20" data-inputtype="tel" />
    </div>
    <div class="form-row required-field">
    <div class="label-cell">
    <label for="InvoiceToAddress_Mobile">Telefono movil</label>
    </div>
    <input id="InvoiceToAddress_MobileAC" type="text" onfocus="emptyElement('status')" name="InvoiceToAddress_MobileAC" class="text date hint" size="3" maxlenght="3" value placeholder="" />
    <input id="InvoiceToAddress_Mobile" type="text" onfocus="emptyElement('status')" name="InvoiceToAddress_Mobile" class="text" value title="Por favor introduzca su calle / numero."maxlenght="20" data-inputtype="tel" />
    </div>
    <div class="form-row">
    <div class="label-cell">
    <label for="InvoiceToAddress_BirthdateD">Fecha de nacimiento</label>
    </div>
    <input id="InvoiceToAddress_BirthdateD" type="text" onfocus="emptyElement('status')" name="InvoiceToAddress_BirthdateD" class="text date hint" size="2" maxlenght="2" value placeholder="DD" />
    <input id="InvoiceToAddress_BirthdateM" type="text" onfocus="emptyElement('status')" name="InvoiceToAddress_BirthdateM" class="text date hint" size="2" maxlenght="2" value placeholder="MM" />
    <input id="InvoiceToAddress_BirthdateY" type="text" onfocus="emptyElement('status')" name="InvoiceToAddress_BirthdateY" class="text date-big" size="4" maxlenght="2" value placeholder="YYYY" />
    </div>
    <br />
    <div class="form-row required-field important">
    <div class="label-cell">
    <label for="InvoiceToAddress_Username">Nombre de usuario
    <span id="unamestatus"></span>
    </label>
    </div>
    <input id="InvoiceToAddress_Username" type="text" onblur="checkusername()" onkeyup="restrict('InvoiceToAddress_Username')" name="InvoiceToAddress_Username" class="text" value title="Por favor cree su nombre de usuario."maxlenght="16" /><span id="unamestatus">Tal vez</span>
    </div>
    <div class="form-row required-field important">
    <div class="label-cell">
    <label for="InvoiceToAddress_Password">Contraseña</label>
    </div>
    <input id="InvoiceToAddress_Password" type="password" onfocus="emptyElement('status')" onkeyup="restrict('InvoiceToAddress_Password')" name="InvoiceToAddress_Password" class="text" value title="Por favor cree su nombre de usuario."maxlenght="16" />
    </div>
    <div class="form-row required-field important">
    <div class="label-cell">
    <label for="InvoiceToAddress_ConfirmPss">Confirme su contraseña</label>
    </div>
    <input id="InvoiceToAddress_ConfirmPss" type="password" onfocus="emptyElement('status')" name="InvoiceToAddress_ConfirmPss" class="text" value title="Por favor cree su nombre de usuario."maxlenght="16" /><span id="status">Prueba</span>
    </div>
    <br />
    <div class="sub-submit">
    <a class="btn-process" onclick="signup()" >Crear cuenta</a>
    </div>
    </fieldset>
    </form>
    <br />
    <br />
    </div>
    </div>
    <div>

Thread Information

Users Browsing this Thread

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

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