quinnipiac0807
Programmer
I have a form that has two asp:buttons on it. When one button is pushed, I want the page to do some validation that I'me doing with Javascript and submit based on a condition, BUT, if the second button is pushed, I just want it to submit without any validation. What I'm doing now is, in the form tag onsubmit="javascript:return Submit()".
function Submit(){
var index = document.all.ddlAppRoles.selectedIndex;
var roleid = document.all.ddlAppRoles.options[index].value;
var userid = document.all.userSelect1_txtid.value;
var username = document.all.userSelect1_txt.value;
var valid = document.all.userSelect1_spnValid.innerText;
if(roleid > 0 && userid != '' && username != '' && valid != 'Invalid'){
return true;
}
else{
alert('Please enter all information');
return false;
}
I know that the validation part works, but if it's a certain button that I'm pressing I just want to submit the form, b/c it doesn't matter what's in those variables. Any suggestion?
function Submit(){
var index = document.all.ddlAppRoles.selectedIndex;
var roleid = document.all.ddlAppRoles.options[index].value;
var userid = document.all.userSelect1_txtid.value;
var username = document.all.userSelect1_txt.value;
var valid = document.all.userSelect1_spnValid.innerText;
if(roleid > 0 && userid != '' && username != '' && valid != 'Invalid'){
return true;
}
else{
alert('Please enter all information');
return false;
}
I know that the validation part works, but if it's a certain button that I'm pressing I just want to submit the form, b/c it doesn't matter what's in those variables. Any suggestion?