# HG changeset patch # User Kim Alvefur # Date 1592934846 -7200 # Node ID 1eb2b9483081a3a611856c813e63188049e4a36a # Parent 78f1de5301fc36b8c55e4b41da40c70b14190752 mod_adhoc_dataforms_demo: Treat 'execute' action as 'next' except in first step diff -r 78f1de5301fc -r 1eb2b9483081 mod_adhoc_dataforms_demo/mod_adhoc_dataforms_demo.lua --- a/mod_adhoc_dataforms_demo/mod_adhoc_dataforms_demo.lua Tue Jun 23 19:40:55 2020 +0200 +++ b/mod_adhoc_dataforms_demo/mod_adhoc_dataforms_demo.lua Tue Jun 23 19:54:06 2020 +0200 @@ -134,6 +134,12 @@ .. serialization.serialize(state, { fatal = false }), }; end + if state and data.action == "execute" then + data.action = "next"; + elseif not state and data.action == "next" then + -- Prevent jumping directly to step 2 + return { status = "canceled", error = "Invalid action" }; + end state = state or { step = 1, forms = { } }; if data.action == "next" then @@ -163,6 +169,7 @@ local next_step = { status = "executing", form = current_form, + default = "next", actions = { "next", "complete" },