I am using event.get.source, to get the text of inputcheckbox when it is clicked. But i am getting error in the [Cannot read property 'get' of undefined]. Previously it was working fine.


<ui:inputcheckbox aura:id="taskCheckBox1" text="{!v.accountDetail.BillingStreet}" label="{!v.accountDetail.BillingStreet}" change="{!c.updateCheckboxes1}" />

<ui:inputcheckbox aura:id="taskCheckBox2" text="{!v.accountDetail.BillingCity}" label="{!v.accountDetail.BillingCity}" change="{!c.updateCheckboxes1}" />


updateCheckboxes1: function(component, event) {
    var id = event.source.get("v.text");

    //  alert('id account field value' + id);
    if (event.source.get("v.value")) {
        // Checkbox is checked - add id to checkedAccInfo
        if (component.get("v.checkedAccInfo").indexOf(id) < 0) {
    } else {
        // Checkbox is unchecked - remove id from checkedAccInfo
        var index = component.get("v.checkedAccInfo").indexOf(id);
        if (index > -1) {
            component.get("v.checkedAccInfo").splice(index, 1);

In controller you using event.source to get text associated with ui:inputcheckbox component not use like this event.source.get("v.text"); instead you use event.getSource()

var id = event.getSource().get("v.text");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.