Sha256: 0badf749daf9634a848863f3d6543fc5d8a6b428289d6231eb34bbd34c03819f

Contents?: true

Size: 1.11 KB

Versions: 4

Compression:

Stored size: 1.11 KB

Contents

# -----------------------------------------------------------------------------
# Author: Alexander Kravets <alex@slatestudio.com>,
#         Slate Studio (http://www.slatestudio.com)
# -----------------------------------------------------------------------------
# INPUT HIDDEN
# -----------------------------------------------------------------------------
class @InputHidden
  constructor: (@name, @value, @config, @object) ->
    @_create_el()

    return this

  # PRIVATE ===================================================================

  _create_el: ->
    @$el =$ "<input type='hidden' name='#{ @name }' value='#{ @_safe_value() }' />"

  _safe_value: ->
    if typeof(@value) == 'object'
      return JSON.stringify(@value)
    else
      _escapeHtml(@value)

  # PUBLIC ====================================================================

  showErrorMessage: (message) -> ;

  hideErrorMessage: -> ;

  initialize: ->
    @config.onInitialize?(this)

  hash: (hash={}) ->
    hash[@config.klassName] = @$el.val()
    return hash

  updateValue: (@value) ->
    @$el.val(@value)

chr.formInputs['hidden'] = InputHidden

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
formagic-0.3.10 app/assets/javascripts/formagic/inputs/hidden.coffee
formagic-0.3.9 app/assets/javascripts/formagic/inputs/hidden.coffee
formagic-0.3.8 app/assets/javascripts/formagic/inputs/hidden.coffee
formagic-0.3.7 app/assets/javascripts/formagic/inputs/hidden.coffee