Şimdi Ara

Java Submit Hakkında yardım

Daha Fazla
Bu Konudaki Kullanıcılar: Daha Az
3 Misafir (1 Mobil) - 2 Masaüstü1 Mobil
5 sn
2
Cevap
0
Favori
917
Tıklama
Daha Fazla
İstatistik
  • Konu İstatistikleri Yükleniyor
0 oy
Öne Çıkar
Sayfa: 1
Giriş
Mesaj
  • Ben bu forumu tamamlamaya çalışıyorum fakat submite bastığımda girdigim bilgiler dogrulandı ise ekrana gelmesi gerekiyor showme ile fakat dogruda girsem yanlışta girsem hiçbirşey gelmiyor acaba neden?

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
    "http://www.w3.org/TR/HTML4.01/strict.dtd">

    <html>

    <head>

    <title>Password Validation</title>
    <script language="JavaScript"
    type="text/javascript">
    <!--

    function ProcessForm()
    {
    showMe();
    }//end ProcessForm()
    function showMe() {
    var name;
    name=window.document.frmMain.txtName.value;
    var surname;
    surname=window.document.frmMain.txtSurname.value:
    var username;
    username=window.document.frmMain.txtUsername.value;
    var password;
    password=window.document.frmMain.txtPassword.value;
    var city;
    index =window.document.frmMain.selectCity.selectedIndex;
    cityName=window.document.frmMain.selectCity[index].text;
    alert("Your name :" + name + "\nSurname :" + surname + "\nUsername :" + username + "\nCity Name :" + cityName + "\nPassword :" + password);
    document.frmMain.selectCity.selectedIndex=0;
    }

    function ValidateForm(FormToCheck)
    {
    var fObjPassword = new Object();
    var fObjConfirm = new Object();

    fObjPassword = window.document.getElementById("txtPassword");
    fObjConfirm = window.document.getElementById("txtConfirm");

    if(ValidatePassword(fObjPassword,fObjConfirm) == true)
    {
    return true;
    }else{
    return false;
    }//end if

    }//end ValidateForm()

    function ValidatePassword(Password,PasswordConfirm)
    {
    var bolIsError = new Boolean(false);
    var strErrorMsg = new String("");
    var objError = new Object();

    if((CheckForEmpty(Password.value) == true))
    {
    bolIsError = true;
    strErrorMsg = "ERROR: Password is blank. You must type a valid password.";
    objError = Password;
    }else if((CheckForEmpty(PasswordConfirm.value))){
    bolIsError = true;
    strErrorMsg = "ERROR: Confirm field is blank. You must confirm your password.";
    objError = PasswordConfirm;
    }else if((Password.value)!=(PasswordConfirm.value)){
    bolIsError = true;
    strErrorMsg = "ERROR: Password and confirm field do not match. They must match.";
    objError = Password;
    }else if(InvalidLength(Password.value,7,11)){
    bolIsError = true;
    strErrorMsg = "ERROR: Password must be between 7 and 11 characters long.";
    objError = Password;
    }else if(InvalidChars(Password.value)){
    bolIsError = true;
    strErrorMsg = "ERROR: Your password contains illegal characters. Please use ";
    strErrorMsg += "ONLY UPPERCASE LETTERS, lowercase letters or digits (0-9).";
    objError = Password;
    }else if(MeetMinReqs(Password.value)){
    bolIsError = true;
    strErrorMsg = "ERROR: Your password MUST contain AT LEAST ONE UPPERCASE LETTER, ";
    strErrorMsg += "AT LEAST ONE lowercase letter and AT LEAST ONE digit.";
    objError = Password;
    }//end if

    if(bolIsError == true)
    {
    window.alert(strErrorMsg);
    objError.select();
    return false;
    }else{
    return true;
    }//end if
    }//end ValidatePassword

    function CheckForEmpty(FieldToCheck)
    {
    var onlySpacesRE = /^\s+$/;

    if((FieldToCheck.match(onlySpacesRE)) ||
    (FieldToCheck == null) ||
    (FieldToCheck == ""))
    {
    return true;
    }else{
    return false;
    }//end if

    }//end CheckForEmpty

    function InvalidLength(FieldToCheck,MinLength,MaxLength)
    {
    if(typeof(FieldToCheck) != "string")
    {
    FieldToCheck = FieldToCheck.toString();
    }//end if

    if((FieldToCheck.length < 7) ||
    (FieldToCheck.length > 11))
    {
    return true;
    }else{
    return false;
    }//end if
    }//end InvalidLength

    function InvalidChars(FieldToCheck)
    {
    var invalidCharsRE = /[^a-zA-Z0-9]/;

    if(FieldToCheck.match(invalidCharsRE))
    {
    return true;
    }else{
    return false;
    }//end if
    }//end InvalidChars

    function MeetMinReqs(FieldToCheck)
    {
    var lowercaseRE = /[a-z]+/g;
    var uppercaseRE = /[A-Z]+/g;
    var digitsRE = /[0-9]+/g;

    if((FieldToCheck.search(lowercaseRE) == -1) ||
    (FieldToCheck.search(uppercaseRE) == -1) ||
    (FieldToCheck.search(digitsRE) == -1))
    {
    return true;
    }else{
    return false;
    }//end if
    }//end MeetMinReqs
    // -->
    </script>
    </head>


    <body>
    <form name = "frmMain"
    id = "frmMain"
    action = "JavaScript:ProcessForm();"
    method = "post"
    onSubmit = "JavaScript:return ValidateForm(this);">
    <p>Name
    <input name="txtName" type="text" id="txtName" value="" size="30" maxlength="50" />
    <br>
    <br />
    Surname
    <input name="txtSurname" type="text" id="txtSurname" value="" size="30" maxlength="50" />
    <br>
    <br>
    <label>City
    <select name="selectCity" id="selectCity">
    <option value="34">Istanbul</option>
    <option value="06">Ankara</option>
    <option value="35">Izmir</option>
    <option value="16">Bursa</option>
    <option value="01">Adana</option>
    <option value="33">Mersin</option>
    <option value="10">Balıkesir</option>
    </select>
    </label>
    <br>
    <br />
    Username:

    <label>
    <input name="txtUsername" type="text" id="txtUsername" value="" size="30" maxlength="50" />
    </label>
    </p>
    <p>
    <label></label>
    Password:
    <input type="password"
    name="txtPassword"
    id="txtPassword"
    size="15" />
    </p>
    <p>Confirm your password:
    <input type="password"
    name="txtConfirm"
    id="txtConfirm"
    size="15" />
    <br />
    <br />
    </p>
    <p>
    <label></label>
    <br />
    <br />
    <br />
    <input type = "submit" id = "btnSubmit" name = "btnSubmit" value = "Submit" />
      
    <input type = "reset"
    id = "btnReset"
    name = "btnReset"
    value = "Reset">
    </p>
    </form>
    </center>

    </body>

    </html>







  • showme'nin içinde index ve cityName tanımlanmamış.
  • 
Sayfa: 1
- x
Bildirim
mesajınız kopyalandı (ctrl+v) yapıştırmak istediğiniz yere yapıştırabilirsiniz.