Class: DrgcmsFormFields::HiddenField

Inherits:
DrgcmsField show all
Defined in:
app/models/drgcms_form_fields/hidden_field.rb

Overview

Implementation of hidden DRG CMS form field.

Will create hidden_field on form.

Form options:

  • name: field name

  • type: hidden_field

Form example:

10:
  name: im_hidden
  type: hidden_field

Instance Attribute Summary

Attributes inherited from DrgcmsField

#css, #js

Instance Method Summary collapse

Methods inherited from DrgcmsField

#__css_code, get_data, #hash_to_options, #html, #initialize, #record_text_for, #ro_standard, #set_css_code, #set_default_value, #set_initial_value, #set_style, #t

Constructor Details

This class inherits a constructor from DrgcmsFormFields::DrgcmsField

Instance Method Details

#renderObject

Render hidden_field field html code



43
44
45
46
47
48
# File 'app/models/drgcms_form_fields/hidden_field.rb', line 43

def render 
  set_initial_value
  value = @yaml['html']['value'] ? @yaml['html']['value'] : @record.send(@yaml['name'])
  record = record_text_for(@yaml['name'])  
  @parent.hidden_field(record, @yaml['name'], value: value)
end