3

How to get Liferay AUI taglib checkbox checked value in AlloyUIi ?

<aui:input type="checkbox" ></aui:input>
abarisone
  • 3,707
  • 11
  • 35
  • 54
Devang Solanki
  • 153
  • 2
  • 13

3 Answers3

2

You can get checkbox's checked value by attr method like A.one("#id").attr('checked') where id will be element id of checkbox.

Pankaj Kathiriya
  • 4,210
  • 2
  • 19
  • 26
2

I have developed entire solution for get single checkbox values, It might help to other AUI Script Developer

AUI().ready('aui-node',function(A) {
    A.all(':checkbox').each(function() {
        this.on('click', function(event) {
        var checkBoxStatus = A.all(':checked');
            if(checkBoxStatus.attr('checked') == 'true') {
            // your conditional code
            }
            else { 
            // your conditional code
            }
        });
    });
});
Simone Celia
  • 144
  • 2
  • 3
  • 11
Devang Solanki
  • 153
  • 2
  • 13
1
AUI().ready('aui-base','event','node', function(A){
   if(A.one("#<portlet:namespace />termsAndCondition")){
      A.one('#<portlet:namespace/>termsAndConditionCheckbox').on('click',function(e){ // it  requires Checkbox as prefix in AUI`enter code here`
        if(A.one("#<portlet:namespace/>termsAndConditionCheckbox").attr('checked')){            
            // your code
        }else{              
           // your code
        }
            });
        }
    });
Harsh
  • 2,893
  • 29
  • 16