Note that there are some explanatory texts on larger screens.

plurals
  1. POCancel button on a form causing meteor to throw exceptions when redraw happens
    primarykey
    data
    text
    <p>I'm struggling to get a cancel button work on a meteor form. There is some interaction between the button and the reactivity on the form that is causing exceptions.</p> <p>I have a form with two buttons, some inputs and some check boxes. The check boxes trigger some more input fields to be shown/hidden (which is working fine).</p> <p>The cancel button, if pressed <strong>before</strong> any check box is used works fine. Once a check box has been activated however the app blows up with an exception as soon as a checkbox is checked (but after the extra input fields have displayed).</p> <pre><code>&gt; Exception from Deps recompute: &gt; Patcher._copyAttributes@http://localhost:3000/packages/spark.js?3a050592ceb34d6c585c70f1df11e353610be0ab:1797 &gt; Patcher.prototype.match@http://localhost:3000/packages/spark.js?3a050592ceb34d6c585c70f1df11e353610be0ab:1552 &gt; patch/&lt;@http://localhost:3000/packages/spark.js?3a050592ceb34d6c585c70f1df11e353610be0ab:1364 &gt; patch/visitNodes@http://localhost:3000/packages/spark.js?3a050592ceb34d6c585c70f1df11e353610be0ab:1320 &gt; patch/visitNodes@http://localhost:3000/packages/spark.js?3a050592ceb34d6c585c70f1df11e353610be0ab:1321 &gt; patch/visitNodes@http://localhost:3000/packages/spark.js?3a050592ceb34d6c585c70f1df11e353610be0ab:1321 &gt; patch/visitNodes@http://localhost:3000/packages/spark.js?3a050592ceb34d6c585c70f1df11e353610be0ab:1321 &gt; patch/visitNodes@http://localhost:3000/packages/spark.js?3a050592ceb34d6c585c70f1df11e353610be0ab:1321 &gt; patch@http://localhost:3000/packages/spark.js?3a050592ceb34d6c585c70f1df11e353610be0ab:1334 &gt; Spark.renderToRange/&lt;/&lt;@http://localhost:3000/packages/spark.js?3a050592ceb34d6c585c70f1df11e353610be0ab:699 &gt; LiveRange.prototype.operate@http://localhost:3000/packages/liverange.js?b3097d72d458e645fd4f0021c8ff5189abe8d98a:491 &gt; Spark.renderToRange/&lt;@http://localhost:3000/packages/spark.js?3a050592ceb34d6c585c70f1df11e353610be0ab:693 &gt; withEventGuard@http://localhost:3000/packages/spark.js?3a050592ceb34d6c585c70f1df11e353610be0ab:162 &gt; Spark.renderToRange@http://localhost:3000/packages/spark.js?3a050592ceb34d6c585c70f1df11e353610be0ab:692 &gt; Spark.isolate/&lt;@http://localhost:3000/packages/spark.js?3a050592ceb34d6c585c70f1df11e353610be0ab:925 &gt; ._compute@http://localhost:3000/packages/deps.js?eba25ec453bb70e5ae5c2c54192d21e0e4d82780:183 &gt; ._recompute@http://localhost:3000/packages/deps.js?eba25ec453bb70e5ae5c2c54192d21e0e4d82780:196 &gt; .flush@http://localhost:3000/packages/deps.js?eba25ec453bb70e5ae5c2c54192d21e0e4d82780:288 </code></pre> <p>All the digging I've done seems to indicate a problem with the HTML but I can't find it. I've eliminated all of the code in the form and replaced it to narrow down the problem to the cancel button.</p> <p>The form code is</p> <pre><code>&lt;template name="joinLayout"&gt; &lt;section class="content" &gt; &lt;div class="modal fade in show" role="dialog" tabindex="-1" aria-hidden="true"&gt; {{&gt; joinLayoutInner}} &lt;/div&gt; &lt;/section&gt; &lt;/template&gt; &lt;template name="joinLayoutInner"&gt; &lt;div class="modal-header"&gt; &lt;h1&gt;Thankyou for Joining Tradebase.&lt;/h1&gt; &lt;h3&gt;Please fill in the information below.&lt;/h3&gt; &lt;/div&gt; &lt;form id="joinForm" action="action" class="col-sm-10 form-horizontal" role="form"&gt; &lt;div class="modal-body"&gt; &lt;div class="form-group"&gt; &lt;label for="joinEmail" class="col-sm-2 control-label"&gt;Email&lt;/label&gt; &lt;div class="col-sm-10"&gt; &lt;input type="email" class="form-control" id="joinEmail" placeholder = "Required"&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;label for="joinPassword" class="col-sm-2 control-label"&gt;Password&lt;/label&gt; &lt;div class="col-sm-10"&gt; &lt;input type="password" class="form-control" id="joinPassword" placeholder = "Required"&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;label for="joinPhone" class="col-sm-2 control-label"&gt;Phone&lt;/label&gt; &lt;div class="col-sm-10"&gt; &lt;input type="tel" class="form-control" id="joinPhone" placeholder = "Required"&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;label for="joinSuburb" class="col-sm-2 control-label"&gt;Suburb&lt;/label&gt; &lt;div class="col-sm-10"&gt; &lt;input type="text" class="form-control" id="joinSuburb" placeholder = "Required"&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;label for="joinState" class="col-sm-2 control-label"&gt;State&lt;/label&gt; &lt;div class="col-sm-10"&gt; &lt;input type="text" class="form-control" id="joinState" placeholder = "Required"&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;label for="joinPostCode" class="col-sm-2 control-label"&gt;Post Code&lt;/label&gt; &lt;div class="col-sm-10"&gt; &lt;input type="text" class="form-control" id="joinPostCode" placeholder = "Required"&gt; &lt;/div&gt; &lt;/div&gt; {{#if joinTradie}} &lt;div class="form-group"&gt; &lt;label for="joinTradeCat" class="col-sm-2 control-label"&gt;Trade Category&lt;/label&gt; &lt;div class="col-sm-10"&gt; &lt;input type="text" class="form-control" id="joinTradeCat" placeholder = "Required"&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;label for="joinLicNo" class="col-sm-2 control-label"&gt;License Number&lt;/label&gt; &lt;div class="col-sm-10"&gt; &lt;input type="text" class="form-control" id="joinLicNo" placeholder = "Required"&gt; &lt;/div&gt; &lt;/div&gt; {{/if}} {{#if joinStudent}} &lt;div class="form-group"&gt; &lt;label for="joinCourse" class="col-sm-2 control-label"&gt;Course&lt;/label&gt; &lt;div class="col-sm-10"&gt; &lt;input type="text" class="form-control" id="joinCourse" placeholder = "Required"&gt; &lt;/div&gt; &lt;/div&gt; {{/if}} &lt;div class="form-group well" id="joinWell"&gt; &lt;label class="checkbox-inline input-lg"&gt; &lt;input id="joinUserCheck" type="checkbox" value="user" name="role" disabled checked&gt;User&lt;/input&gt; &lt;/label&gt; &lt;label class="checkbox-inline input-lg"&gt; &lt;input id="joinTradieCheck" type="checkbox" value="tradie" name="role" &gt;Tradie&lt;/input&gt; &lt;/label&gt; &lt;label class="checkbox-inline input-lg"&gt; &lt;input id="joinSponsorCheck" type="checkbox" value="sponsor" name="role" &gt;Sponsor&lt;/input&gt; &lt;/label&gt; &lt;label class="checkbox-inline input-lg"&gt; &lt;input id="joinStudentCheck" type="checkbox" value="student" name="role" &gt;Student&lt;/input&gt; &lt;/label&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="modal-footer"&gt; &lt;div class="form-group"&gt; &lt;div class="col-sm-offset-2 col-sm-5"&gt; &lt;button type="submit" class="btn btn-primary btn-lg pull-left"&gt;Join&lt;/button&gt; &lt;/div&gt; &lt;div class"col-sm-5"&gt; &lt;button type="button" id="joinCancel" class="bnt btn-default btn-lg pull-right"&gt;Cancel&lt;/button&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/form&gt; &lt;/template&gt; </code></pre> <p>and the associated js</p> <pre><code>Template.joinLayoutInner.events({ 'click #joinTradieCheck': function(e) { console.log("Tradie checkbox clicked"); Session.set("joinTradieTag", (joinTradieCheck.checked?1:0)); }, 'click #joinStudentCheck': function(e) { console.log("Student checkbox clicked"); Session.set("joinStudentTag", (joinStudentCheck.checked?1:0)); }, 'click #joinSponsorCheck': function(e) { console.log("Sponsor checkbox clicked"); Session.set("joinSponsorTag", (joinSponsorCheck.checked?1:0)); } }); Template.joinLayoutInner.helpers({ joinTradie: function() { return Session.get("joinTradieTag"); }, joinStudent: function() { return Session.get("joinStudentTag"); }, joinSponsor: function() { return Session.get("joinSponsorTag"); } }); Template.joinLayout.events({ 'click #joinCancel': function(e) { e.preventDefault(); Router.go('loginPage'); }, 'submit #joinForm': function(e,t) { e.preventDefault(); console.log("Form Sumbitted"); } }); </code></pre> <p>If I comment out the html line for the cancel button, everything works as expected. As soon as I put that button back in.. boom.</p> <p>Any ideas please?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload