I have a form that displays, and when i click the submit button it logs the values to the console.
How can i persist the settings so i can access them elsewhere in the application and the form is prepopulated when i return to the form screen?
I have my form set up like this
class ChimeScreen < FormotionScreen
title "Chime"
def on_submit(_form)
data = _form.render
# settings.enable = data[:enable]
# settings.alarm_time = data[:alarm_time]
PM.logger.debug data[:alarm_time]
open BrowseScreen
end
def table_data
{
...
}
end
Formotion allows persistent data by setting the persist_as
value on the form.
See example here: https://github.com/clayallsopp/formotion/tree/master/examples/Persistence
You can then retrieve this form data as a hash by looking into
App::Persistence["FORMOTION_#{your_symbol_persisting_as_here}"]