js/script.js
//This function checks if there are any empty fields.
This function checks if there are any empty fields.
This function checks if there are any empty fields .
function checkFilled(){
    var day = document.forms['namingForm']['day'].value;
    var month = document.forms['namingForm']['month'].value;
    var year = document.forms['namingForm']['year'].value;
    var gender = document.getElementsByName('gender');
    if(gender[0].checked == true){
        gender = "male";
    }else if(gender[1].checked == true){
        gender = "female";
    }else{
        gender = "";
    }
    var defaultErr = document.getElementById('danger-notif');
    var genderErr = document.getElementById('gender-notif');
    var yearErr = document.getElementById('year-notif');
    var monthErr = document.getElementById('month-notif');
    var dayErr = document.getElementById('day-notif');
    if(year === "" || month === "" || day === "" || gender === ""){
        defaultErr.style.display = "inline";
        genderErr.style.display = "none";
        yearErr.style.display = "none";
        monthErr.style.display = "none";
        dayErr.style.display = "none";
    }else{
        if(defaultErr.style.display == "inline"){
            defaultErr.style.display = "none";
        }
    }
    checkWhichNotFilled(day, month, year, gender);
}
function checkFilled ( ) { var day = document . forms [ 'namingForm' ] [ 'day' ] . value ; var month = document . forms [ 'namingForm' ] [ 'month' ] . value ; var year = document . forms [ 'namingForm' ] [ 'year' ] . value ; var gender = document . getElementsByName ( 'gender' ) ; if ( gender [ 0 ] . checked == true ) { gender = "male" ; } else if ( gender [ 1 ] . checked == true ) { gender = "female" ; } else { gender = "" ; } var defaultErr = document . getElementById ( 'danger-notif' ) ; var genderErr = document . getElementById ( 'gender-notif' ) ; var yearErr = document . getElementById ( 'year-notif' ) ; var monthErr = document . getElementById ( 'month-notif' ) ; var dayErr = document . getElementById ( 'day-notif' ) ; if ( year === "" || month === "" || day === "" || gender === "" ) { defaultErr . style . display = "inline" ; genderErr . style . display = "none" ; yearErr . style . display = "none" ; monthErr . style . display = "none" ; dayErr . style . display = "none" ; } else { if ( defaultErr . style . display == "inline" ) { defaultErr . style . display = "none" ; } } checkWhichNotFilled ( day , month , year , gender ) ; }
This function checks if there are any empty fields.
This function checks if there are any empty fields .
//Check for gender selected. //Checks for info not provided or errors.