javascriptjqueryignite-uiigcombo

igCombobox, how do I prevent submisson if nothing selected?


I have an igCombobox "checkbox", when nothing is selected it still submits the form, which I dont want to happen.

I'm using this code to submit:

 <div id="checkboxSelectCombo" name="kanal" style="position:absolute;" ></div>

 $("#checkboxSelectCombo").on( "focusout",function() {
  $(this).closest("form").submit();
     });

So, I tried to use if statement, if value is greater than zero or is not an empty string

$("#checkboxSelectCombo").on( "focusout",function() {
             if($(this).val()>0 || $(this).val()!=""){
  $(this).closest("form").submit();}
     });

But since I cant get the value from checkboxSelectCombo it wont work. I already searched igCombobox documentation, but didn't find anything.


Solution

  • I found a solution to my problem. As Zdravko Kolev said that I should use dropDownClosed, I was able to prevent submit without selecting anything on the igComboBox with this code

     dropDownClosed: function (evt, ui) {
                    var dpValue = ui.owner.value();  
                     if(dpValue != 0){                 //dpValue>0
                    $(this).closest("form").submit();
                     }
                }