如何验证父亲,母亲或监护人的详细信息?

时间:2017-06-15 05:17:14

标签: android

您好我有12个EditText字段,其中4个用于父亲详细信息4用于母亲详细信息4用于监护人详细信息,我想做的是用户可以放置父亲或母亲或监护人的所有详细信息我已完成所有验证但是,不知道怎么检查

 private boolean isValidate() {

        boolean isValidate = false;
           //father validation
         if (edtFatherFristName.getText().toString().length() == 0) {
            showToast(R.string.please_enter_fisrt_name);
        } else if (edtFatherLastName.getText().toString().length() > 250) {
            showToast(R.string.name_cannot_exceed2);
        } else if (edtFatherLastName.getText().toString().length() == 0) {
            showToast(R.string.please_enter_last_name);
        } else if (edtFatherLastName.getText().toString().length() > 250) {
            showToast(R.string.name_cannot_exceed2);
        } else if (edtFatherEmail.getText().toString().length() == 0) {
            showToast(R.string.enter_emailid);
        } else if (!Utility.isValidEmail(edtFatherEmail.getText().toString().trim())) {
            showToast(R.string.email_validation);
        } else if (edtFatherContect.getText().toString().length() == 0) {
            showToast(R.string.enter_phone_no);
        } else if (edtFatherContect.getText().toString().length() < 10) {
            showToast(R.string.enter_valid_phone);
        }
         //Mother Validation
        else if (edtMotherFristName.getText().toString().length() == 0) {
            showToast(R.string.please_enter_fisrt_name);
        } else if (edtMotherFristName.getText().toString().length() > 250) {
            showToast(R.string.name_cannot_exceed2);
        } else if (edtMotherLasttName.getText().toString().length() == 0) {
            showToast(R.string.please_enter_last_name);
        } else if (edtMotherLasttName.getText().toString().length() > 250) {
            showToast(R.string.name_cannot_exceed2);
        } else if (edtMotherEmail.getText().toString().length() == 0) {
            showToast(R.string.enter_emailid);
        } else if (!Utility.isValidEmail(edtMotherEmail.getText().toString().trim())) {
            showToast(R.string.email_validation);
        } else if (edtMotherContect.getText().toString().length() == 0) {
            showToast(R.string.enter_phone_no);
        } else if (edtMotherContect.getText().toString().length() < 10) {
            showToast(R.string.enter_valid_phone);
        }

               // gardian validation
         else if (edtGardianFirstName.getText().toString().length() == 0) {
            showToast(R.string.please_enter_fisrt_name);
        } else if (edtGardianFirstName.getText().toString().length() > 250) {
            showToast(R.string.name_cannot_exceed2);
        } else if (edtGardianLastName.getText().toString().length() == 0) {
            showToast(R.string.please_enter_last_name);
        } else if (edtGardianLastName.getText().toString().length() > 250) {
            showToast(R.string.name_cannot_exceed2);
        } else if (edtGardianEmail.getText().toString().length() == 0) {
            showToast(R.string.enter_emailid);
        } else if (!Utility.isValidEmail(edtGardianEmail.getText().toString().trim())) {
            showToast(R.string.email_validation);
        } else if (edtGardianContect.getText().toString().length() == 0) {
            showToast(R.string.enter_phone_no);
        } else if (edtGardianContect.getText().toString().length() < 10) {
            showToast(R.string.enter_valid_phone);
        }
       else
         {
             isValidate=true;
         }


        return isValidate;
      }

0 个答案:

没有答案