Open djay opened 8 years ago
@displacedaussie any options I missed?
You have a form you don't want to save.
In this case, I normally use a page form. Submitting a page form doesn't create a document, but you can add a SAVE action and set the form method to POST. Then you end up having to do your processing in the unfortunately named beforeCreateDocument
formula ("Action to take when opening a blank form"), from which you can of course delegate to library scripts or other forms, etc.
By definition, if a form is not a "page" form, it's meant to be used to create documents. When changing the meaning of a "page" vs non-"page" form (such that a non-"page" form is now also not necessarily meant to create documents), this distinction should be kept in mind to not end up with something very blurry.
Also, a note about "saving a form". You submit a form, which is then used to create and/or edit one (or more, if you like) document(s). A form may create different kinds of documents depending on the data submitted.
Many systems (such as Plone) have the concept of a document with view and edit templates. Plomino is not like that. Plomino has generic documents, and forms. Any form or combination of forms can be used to edit or create any document(s). For this reason, I think that talking about saving a form can be confusing.
User problem
You have a form you don't want to save. But you want to submit, run some code, but then not redirect elsewhere. e.g.
Options
Jump action
Instead of just a submit without save action, what about combining it with the ability to jump to a certain field or page in a multipage form (functionality we need for an upcoming multipage PR). Jump action is a new kind of action with a formula where you can return either the id of a field, or an integer.
In the future with helpers it would be possible to create a UI which lets you pick the field from a list instead of writing a formula.
The formula could have additional code in it to do things like stream data back to the client without the data being saved, for example to return it as a CSV.
"Submit to" action
Similar to above but specify a url to submit to. Similar to a redirect but POST data is preserved.
Additionally you can allow one form to submit into another which is not currently easy.