0

These 3 contact information (Home No., Mobile No. & Email Address) should be filled out at least one. If the user enters a wrong information for one of these contact information, the trapping code will be executed.

But unfortunately, my codes doesn't working...

   else if ((Homeno.equals("")) || (MobileNo.equals("")) || (Email.equals("")) ) {
    Toast.makeText(getApplicationContext(), 
    "Please enter at least one (1) your contact information.", Toast.LENGTH_SHORT).show();
}

//TRAPPING CODES
//Tel no. Validator
else if (Homeno.length()<9) {
    Toast.makeText(getApplicationContext(), 
    "Invalid Telephone Number!", Toast.LENGTH_SHORT).show();
}

//Mobile Number must be at least 12
else if (MobileNo.length()<12) {
    Toast.makeText(getApplicationContext(), 
    "Mobile Number must be 12 digits!", Toast.LENGTH_SHORT).show();
}

//Mobile Validator
else if (!validcp.matches()) {
    Toast.makeText(getApplicationContext(), 
    "Invalid Mobile Number!", Toast.LENGTH_SHORT).show();
}

//Email validator
else if (!matcherObj.matches()) {
    Toast.makeText(getApplicationContext(), 
    "Invalid Email Address!", Toast.LENGTH_SHORT).show();
}
4

1 に答える 1