Sha256: 97f179343744c8cbd27bd18648c8b8cf0122176d7b0b7cb8fcab1e782e71c746

Contents?: true

Size: 522 Bytes

Versions: 7

Compression:

Stored size: 522 Bytes

Contents

class outpost.Utilities
    # Prevent forms from submitting when the "Enter"
    # key is pressed inside of a text field
    # Pass in an optional form ID to restrict it just to that form.
    @preventEnterFromSubmittingForm: (formId='') ->
        $("form#{formId} input[type=text]").on
            keydown: (event) ->
                key = event.keyCode || event.which

                if key == 13 # Enter
                    event.stopPropagation()
                    event.preventDefault()
                    false

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
outpost-cms-0.1.4 app/assets/javascripts/outpost/utilities.js.coffee
outpost-cms-0.1.3 app/assets/javascripts/outpost/utilities.js.coffee
outpost-cms-0.1.2 app/assets/javascripts/outpost/utilities.js.coffee
outpost-cms-0.1.1 app/assets/javascripts/outpost/utilities.js.coffee
outpost-cms-0.1.0 app/assets/javascripts/outpost/utilities.js.coffee
outpost-cms-0.0.5 app/assets/javascripts/outpost/utilities.js.coffee
outpost-cms-0.0.4 app/assets/javascripts/outpost/utilities.js.coffee