1

I'm trying to use bootstrap switch to control a checkbox on my input form but it is not carrying the value over. Do I need to get the value from the switch somehow?

COMPONENT

         <aura:attribute name="newIdea" type="Idea"
                default="{ 'sobjectType': 'Idea',
                         'Title': '',
                         'Body': '',
                         'Merchants__Anonymous__c':'false',
                         'CommunityId': '09ao0000000a8tqAAA'
                         }"/>
<input type="checkbox" value="!v.newIdea.Merchants__Anonymous__c}" data-label-text="Anonymous" data-on-color="danger"/>
<a id="postButton" href="#" onclick="{!c.postIdea}" class="linkstandard red">Post</a>

CONTROLLER

postIdea : function(component, event, helper)
{
    var newIdea = component.get("v.newIdea");
    helper.createIdea(component, newIdea);  
}

HELPER

createIdea: function(component, newIdea) {
  this.upsertIdea(component, newIdea, function(a) {
      var ideas = component.get("v.ideas");
      ideas.push(a.getReturnValue());
      component.set("v.ideas", ideas);      

      var self = this;
      self.makeIsotope(component);
      $j('#newidea').modal('hide');

  });
}

APEX

    @AuraEnabled
public static Idea createIdea(Idea newIdea)
{upsert newIdea;}

1 Answer 1

2

A couple of contributing issues.

  • looks like you are missing a curly brace in your value= expression:

1
  • I deleted the { when putting up in here. Is there no way to use input elements and make them work? Commented Apr 13, 2015 at 20:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .