method
method field type is used to call helper or class method which will return html code, which will be inserted into form. The code could be used to display embedded data differently than default embedded form could provide.
Another idea is to display data which is related to one of the fields in document. For example display map for the field coordinates.
40:
name: coordinates
type: text_field
group: 2
50:
name: show_map
type: method
eval: show_map_for_coordinates
or
eval: MapHelper.show_map_for_coordinates
name: coordinates
type: text_field
group: 2
50:
name: show_map
type: method
eval: show_map_for_coordinates
or
eval: MapHelper.show_map_for_coordinates
show_map_for_coordinates method would be defined in map_helper.rb
module MapHelper
def show_map_for_coordinates(doc, yaml, readonly)
call_paint_map(doc.coordinates)
end
or
def self.show_map_for_coordinates(doc, yaml, readonly)
call_paint_map(doc.coordinates)
end
end
def show_map_for_coordinates(doc, yaml, readonly)
call_paint_map(doc.coordinates)
end
or
def self.show_map_for_coordinates(doc, yaml, readonly)
call_paint_map(doc.coordinates)
end
end
Last update: 29.01.2022