Get multiple ractive variables and store them to specific key inside the JSON

16 views
Skip to first unread message

aurelio.no...@gmail.com

unread,
Jan 15, 2017, 4:03:15 AM1/15/17
to Ractive.js
I'm currently trying to learn `ractive js` at the moment. Right now I'm figuring how I can store a dynamic value and pass it to a specific key inside the JSON
I have managed to get the value using `app.get` but how I do store it or pass it to a specific key inside the JSON. I created a button that will trigger the event.


    <div class="form-element-container">
       
<label>Company Name <span class="required">*</span></label>
       
<input type="text" class="form-text full-width" placeholder="Enter the company name" id="accountName" value="{{leadData.accountName}}"/>
   
</div>


   
<div class="col col2">
       
<label>Street Name.</label>
       
<input type="text" class="form-text" placeholder="-" id="streetName" value="{{leadData.streetName}}"/>
   
</div>


   
<div class="form-element-container default-cta-container">
       
<a class="button cta" on-click="addLead">Create Account</a>
   
</div>



        ractive.on('addLead', function(event) {
         
var leadData     = {},
         
var addData      = ractive.get('leadData');


           ractive
.set(function(addData, data) {
               
var leadData     = {
                   
"accountName" : data.accountName,
                   
"streetName"    : data.streetName,
               
}
           
});


       
});


aurelio.no...@gmail.com

unread,
Jan 15, 2017, 4:09:39 AM1/15/17
to Ractive.js
Correction its ractive.get not app.get
Reply all
Reply to author
Forward
0 new messages