assistance

admin

Administrator
Staff member
Hi everybody, I currently self learning Java Script.
I need some assistance from here. The code listed below is performing validation to a form. But i will like to use function alphabetsOnly() for the user name to contain alphabets only. If it contain numeric character should return as false and should return true if it contain alphabets.

After so many attemps still not sucessful. Kindly advise me where to insert the function alphabetsOnly().

Thanks



function verify(){

var errFlag = false;
var errMsg = "Error! You must enter the following fields:\n";

errMsg = errMsg + "__________________________________\n\n";

if (isEmpty(preferenceForm.username.value)){
errMsg = errMsg + " - User Name \n";
errFlag = true;
}

var radioChecked = false;
for(var i=0; i < preferenceForm.fontWeight.length; i++){
if (preferenceForm.fontWeight.checked){
radioChecked = true;
}
}
if(radioChecked == false){
errMsg = errMsg + " - Font Weight \n";
errFlag = true;
}


if (errFlag == true){
alert(errMsg);
return false;
}else {
return true;
}

}

function isEmpty(value){
if (value == "")
return true;

return false;
}

:confused:
 
Back
Top