javascript - Events from multiple forms on one page in meteor -


in home.html page, have 2 forms, have been set in same way. problem 1 works , other doesn't. tried putting on of checkboxes broken form working form, , starting working, think it's issue specifying form in javascript template.events code.

html:

<template name="home"> <form> <strong>display factors:</strong><br>            <label class="display-f1"> <input type="checkbox" checked="{{displayf1}}"> 1: cumplimiento de los objetivos del programa </label><br>           <label class="display-f2"> <input type="checkbox" checked="{{displayf2}}"> 2: estudiantes </label><br>           <label class="display-f3"> <input type="checkbox" checked="{{displayf3}}"> 3: profesores </label><br>           </form>            <form>           <label class="display-strengths"> <input type="checkbox" checked="{{displaystrengths}}"> display strengths </label>           <label class="display-insuff"> <input type="checkbox" checked="{{displayinsuff}}"> display insufficiencies </label>           <label class="display-urgencies"> <input type="checkbox" checked="{{displayurgencies}}"> display urgencies </label>           </form> </template> 

javascript:

template.home.events({ "change .display-strengths input": function (event) {   session.set("displaystrengths", event.target.checked); }, "change .display-insuff input": function (event) {   session.set("displayinsuff", event.target.checked); }, "change .display-urgencies input": function (event) {   session.set("displayurgencies", event.target.checked); }, "change .display-f1 input": function (event){     session.set("displayf1", event.target.checked); }, "change .display-f2 input": function(event){     session.set("displayf2", event.target.checked); }, "change .display-f3 input": function(event){     session.set("displayf3", event.target.checked); }, }); 

i have other code relying on session.get, i'm confident problem in code because, in console, session.get('displaystrengths') returns true when appropriate, session.get('displayf1') returns undefined.

it seems problem isn't code provided. check out demo made code provided:

http://meteorpad.com/pad/rm56ry49gq7yyfa6d/leaderboard

if run (with chrome/firefox/whatever console on) , click on each of selections, should see correct corresponding message "i got called x". can type in session.keys directly console , should see expected results.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -