Method: Formotion::FormController#viewDidLoad

Defined in:
lib/formotion/controller/form_controller.rb

#viewDidLoadObject



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/formotion/controller/form_controller.rb', line 37

def viewDidLoad
  super

  # Triggers this block when the enter key is pressed
  # while editing the last text field.
  @form.sections[-1] && @form.sections[-1].rows && @form.sections[-1].rows[-1] && @form.sections[-1].rows[-1].on_enter do |row|
    if row.text_field
      @form.submit
      row.text_field.resignFirstResponder
    end
  end

  # Setting @form.controller assigns
  # @form as the datasource and delegate
  # and reloads the data.
  @form.controller = WeakRef.new(self)
end