0

Hi to all

i make an HTML page and after entering the data when user press the submit button the data stored in database. i also make validation that which text field is optional and which text field is necessary to fulfill.but the problem is that i have 3 text field MAC Address, CPU ID and motherboard ID . In MAC, CPU and Mother board ID One at least is provided.that may be MAC ,CPU ID or Motherboard ID.

how can i validate this....please help

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by stbuchok
0

Pretty sure this is about how it should work.

var cpu = document.getElementById('txtCPU');
var mac = document.getElementById('txtMAC');
var mobo = document.getElementById('txtMOBO');

if(!isNullOrEmpty(cpu) || !isNullOrEmpty(mac) || !isNullOrEmpty(mobo)){
    //at least one is filled out.
}
else{
    //none are filled in.
}

function isNullOrEmpty(element){
    var blnFlag = true;

    if(typeof element === 'undefined' || element === null || element.value === ''){
        blnFlag = true;
    }
    else {
        blnFlag = false;
    }

    return blnFlag;
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.