{form:form_id:ok_code}

Description

Renders a stored AA form by its form id, as an inline item-submission form a visitor can fill in and post. The form must first be defined and saved in the slice Forms admin (se_forms.php); the form id is that saved form object id, not a slice id or a view id. The output is a fieldset holding the form field rows, hidden inline and slice_id inputs, and an Insert button that posts the entry through filler.php. The first parameter form_id selects the form. The optional second parameter ok_code is placed in the form hidden ret_code input and is used as the response shown after a visitor successfully inserts an item. Plain text in it, with aliases, is filled in when the page renders. A command in ok_code is expanded when the page renders, like in any other parameter; text that still holds an expression when the form is built is signed by AA and expanded for the newly inserted item after the save - to keep an expression for the new item, wrap it in an inline alias (deferred-evaluation block). AA runs only expressions it signed itself. From an unsigned value, such as one a visitor puts into the posted form, it accepts only text, aliases and plain field references; anything else is refused and the response comes back empty. A superadmin can switch this protection off for an old site on the Security page. An empty form_id, or one that matches no saved form, yields an empty string. The command is never cached, since the form HTML is rebuilt on every request, and the wrapper id is randomized per render.

Parameters

form_id required default (empty string)

Object id of a stored AA form, defined and saved in the slice Forms admin. It is a form object id, not a slice id or a view id. An empty form_id, or one that matches no saved form, yields an empty string.

ok_code optional default (empty string)

Return code placed in the form hidden ret_code input. It is used as the response after a visitor successfully inserts an item through the form, and may hold plain text with aliases or template code. A command is expanded when the page renders; an expression meant for the new item goes into an inline alias, so AA signs it and expands it after the save.

Examples

virtual{form:09142343c7833cf0b189708d5ea454b3:{(Thank you, {headline........}.)}}
Expected(the form; ret_code holds the expression signed by AA - aa1. plus base64 plus a signature)
Actual
The inline alias keeps the expression unexpanded while the page renders, so it is signed and kept in ret_code; filler.php expands it for the new item after the save, here with its headline. A command AA knows, written without the inline alias, is expanded already when the page renders - a redirect there would fire on every render.
test[{form:}]
Expected[]
Actual[]
With no form id the command returns an empty string, as it does for an id that matches no saved form (example 5). Only the id of a saved form produces live form markup.
virtual{form:09142343c7833cf0b189708d5ea454b3}
Expected(the saved form rendered as an inline Insert form)
Actual
The typical use: pass the id of a form saved in the slice Forms admin. The output is a ready-to-post item-submission form (a fieldset of that form field rows and an Insert button that posts through filler.php). Output is live markup, so this is illustrative rather than a text test.
virtual{form:09142343c7833cf0b189708d5ea454b3:Thank you for your submission.}
Expected(the form, with ret_code set to the thank-you message)
Actual
The second parameter ok_code lands verbatim in the form hidden ret_code input. Here it carries a thank-you message shown after a visitor inserts an item.
test[{form:00000000000000000000000000000000}]
Expected[]
Actual[]
An id that matches no saved form returns an empty string, like an empty id.