Update to 1.4.1.3 broke submit form


#1

Hello! I’m trying to figure out why my submit form helper no longer works after the Meteor update. I have a modal that allows users to update fields then submit and the helper no longer triggers from the submit button.

HTML:

<template name="editModal">
    <div class="modal fade" id="editModal">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">
                        <span aria-hidden="true">&times;</span>
                        <span class="sr-only">Close</span>
                    </button>
                    <h4 class="modal-title">Edit This Marker</h4>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal" role="form">
                        <div class="form-group">
                            <label class="col-sm-2 control-label" for="title">Title</label>
                            <div class="col-sm-10">
                                <input name="title" id="title" type="text" value="{{title}}" placeholder="Marker Title" class="form-control" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label" for="markerInfo">Information</label>
                            <div class="col-sm-10">
                                <textarea name="markerInfo" class="form-control" id="markerInfo" type="text" value="{{markerInfo}}" placeholder="What is this?" rows="3"></textarea>
                            </div>
                        </div>

                        <div class="modal-footer">
                            <input type="submit" value="Submit" class="btn btn-primary submit" id="save" data-dismiss="modal">
                            <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</template>

JS:

Template.editModal.events({
    'submit form': function (e) {
        e.preventDefault();

        var currentMarkerId = infoWindowMarker._id;

        var markerProperties = {
            title: $(e.target).find('[name=title]').val(),
            markerInfo: $(e.target).find('[name=markerInfo]').val()
        }
        
        console.log(markerProperties);

        Markers.update(currentMarkerId, {$set: markerProperties}, function (error) {
            if (error) {
                // display the error to the user
                alert(error.reason);
            }
        });

    }
});

#2

I can’t figure out why an update would broke a basic event.

Try to debug this:

  • Make 100% sure no other things have been updated
  • Does it enter the ‘submit form’ function ?
  • Right click on submit element, inspect it, and go to “Event Listeners” in chrome try to see if no others events are attached to it somehow, and they do a “preventDefault” or “stopPropagation”
  • Try to downgrade to the previous app and see if that’s really the issue. “meteor update --release 1.4.1.2” if it is, then file a bug report to Meteor’s Github, this is very strange.

#3

@diaconutheodor

  1. No other packages were updated.
  2. The ‘submit form’ function is never triggered.
  3. Looking at the Event Listeners, there is only one Event Listener which is body.modal-open. Should there be more than one listener for this action?
  4. Downgraded to meteor 1.4.1.2 and it was still broken. Not sure why this randomly stopped working. I got this functionality to work and then came back to it 6 hours later and it stopped working and all I saw was that Meteor had been patched.

#4

Ok then I assume that your template “js” is not added somehow. Do a:

Template.editModal.onCreated(() => {console.log('I was created.')})

If it doesn’t show it seems you do not include that js. If still shows let me know. Cheers.


#5

The console.log came through loud and clear but the event still doesn’t fire. What else do you think I should try? Also thank you so much for the help!


#6

What web browsers are you using? Is it Beta/Carney? I found Google chrome could not activate Edit button in Facebook while using Carney release.


#7

Thanks for the advice all! I found that including:

data-dismiss="modal"

in the for the submit button didn’t allow the data to be passed into the collection.