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;}
2

A couple of contributing issues.

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

  • I deleted the { when putting up in here. Is there no way to use input elements and make them work? – Brian Romanowski Apr 13 '15 at 20:09

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.