I have an error function in the -dv.js file. I want to show an error if the following is true:
qgate = A1
solutions = 5,6,7,8,10,13,14
reasons <> 'TBC.20' OR 'TBC_10'
The issue I have with the code below is that it shows an error all the time. I change the qgate to 'A1', soloutions to 8 and reasons to TBC.20 but it still comes back with an error too.
can anyone help me with this?
Code: Select all
function show_error(field, msg){
modal_window({
message: '<div class="alert alert-danger">' + msg + '</div>',
title: 'Error in ' + field,
close: function(){
$j('#' + field).focus();
$j('#' + field).parents('.form-group').addClass('has-error');
}
});
return false;
}
$j(function(){
$j('#update, #insert').click(function(){
/* Make sure if Qualitygate is A1 we only allow certain reasons */
var qgate = $j('#qgate').val();
var reasons = $j('#reasons').val();
var solutions = $j('#solutions').val();
console.log(qgate, reasons, solutions);
if((qgate = 'A1') && (solutions == 5 || solutions == 6 || solutions == 7 || solutions == 8 || solutions == 10 || solutions == 13 || solutions == 14 )
&& (reasons != 'TBC.20' || reasons != 'TBC_10'))
{
return show_error('reasons', 'this is a test');
}
});
})