Skip to content

Commit

Permalink
Catch an error when an arbitrary html element carries the .form class
Browse files Browse the repository at this point in the history
  • Loading branch information
Luc Princen committed Dec 22, 2015
1 parent 85ca0e1 commit 8608543
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Assets/js/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ define([

var self = this;
self.el = $( obj );

//stop a form from initting if it's just an arbitrary .form class:
if( self.el.attr('id') === undefined )
return false;

self.fields = self.el.find( '.field' );
self.formId = parseInt( self.el.attr('id').replace( 'form_', '' ) );
self.setEvents();
Expand Down

0 comments on commit 8608543

Please sign in to comment.