Sha256: 0ce5da42e8fe9b335673420bd94cfca29d08ad404da430fa654cbff5f621dd38

Contents?: true

Size: 721 Bytes

Versions: 2

Compression:

Stored size: 721 Bytes

Contents

# TextField
# - a question that prompts for one or more lines of text

module Fe
  class TextField < Question

    # which view to render this element?
    def ptemplate
      if self.style == 'essay'
        'fe/text_area_field'
      else
        'fe/text_field'
      end
    end

    # css class names for javascript-based validation
    def validation_class(answer_sheet)
      validation = ''
      validation += ' required' if self.required?(answer_sheet)
      # validate-number, etc.
      validate_style = ['number', 'currency-dollar', 'email', 'url', 'phone'].find {|v| v == self.style }
      if validate_style
        validation += ' validate-' + validate_style
      end
      validation
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fe-1.0.0 app/models/fe/text_field.rb
fe-0.0.4 app/models/fe/text_field.rb