- Wed Mar 21, 2018 4:39 am
#813744
1) User will have a business name in the list
2) User doesn't have a business name in the list but has an alternative business name. He will then check "My business name/trading name is not listed" and type it into a hidden field
3) User doesn't have a business name at all and checks the "I don't have a business trading name"
Both checkboxes disable the "choose business name" drop down list validation, but I realized the user can choose both checkboxes and mess up the validation. (currently, it does mess it up if I validate it several times, the form ends up not responding when the submit button is clicked - no error nada)
Can you please help me with the code? my tests show that it is the "I don't have a business name/trading name" causing the form submission problem and it may be due to the clash of enabling/disabling validation on the drop down list being the issue. I don't really want to use radio buttons either because of possibility no.1 and user cannot clear the radio selection.
Thanks
I have this form which has a drop down list of business names. The possibilities are:
1) User will have a business name in the list
2) User doesn't have a business name in the list but has an alternative business name. He will then check "My business name/trading name is not listed" and type it into a hidden field
3) User doesn't have a business name at all and checks the "I don't have a business trading name"
Both checkboxes disable the "choose business name" drop down list validation, but I realized the user can choose both checkboxes and mess up the validation. (currently, it does mess it up if I validate it several times, the form ends up not responding when the submit button is clicked - no error nada)
Can you please help me with the code? my tests show that it is the "I don't have a business name/trading name" causing the form submission problem and it may be due to the clash of enabling/disabling validation on the drop down list being the issue. I don't really want to use radio buttons either because of possibility no.1 and user cannot clear the radio selection.
Code: Select all
//Show/hide Other Trading Name
$('#BusinessNameAlternative').hide();
$("#BusinessNameNotListed").setOnchange( function(newVal, oldVal) {
//check for version 3.0.1.8 or version 3.1+
if (newVal == '"1"' || newVal == '["1"]') {
$('#BusinessNameAlternative').show();
$('#BusinessNameAlternative').getControl().css({"border": "#FF8C00 solid 1px"});
$('#BusinessNameAlternative').enableValidation();
$('#BusinessNameDropDown').disableValidation();
}
else {
$('#BusinessNameAlternative').hide();
$('#BusinessNameAlternative').disableValidation();
$('#BusinessNameDropDown').enableValidation();
}
} );
//If no business name, disable validation on business name drop down
$("#NoBusinessName").setOnchange( function(newVal1, oldVal1) {
//if value has "1" in it
if (newVal1 == '"1"' || newVal1 == '["1"]'){
$('#BusinessNameDropDown').disableValidation();
}
else {
$('#BusinessNameDropDown').enableValidation();
}
});
Thanks