ajax-form-preview: [method] [return type] [get-pars(parameters)] [post-pars(parameters)] [cache] [every (time)] [after (time)][, ...];
This command simulates a submittance of the form designated by the target selector by an ajax call. The following variables will be found on the server (in GET or POST form depending on the method of the ajax call) when the form is submitted:
- _ACSS = 1
- _ACSSFORMPREVIEW = 1
- _ACSSFORMSUBMIT = 1
- _ACSSTYPE = JSON or HTML
This command is otherwise exactly the same as the ajax-form-submit command, except the after event is "afterAjaxFormPreview".
The other difference is the additional variable "_ACSSFORMPREVIEW" which will get sent to the server which you can use to differentiate if the form has really been submitted or not.
This is useful if you are building an interactive form which affects other areas of the screen during editing, and wish to send data to the server when aspects of the form change, but you don't want to submit the form for real. For example, you are building a CMS and letting the user change a layout style for a page, so you preview-submit and on return in the :afterAjaxFormPreview event you update a section of the page with a preview of what their layout change will draw. You could use this technique in combination with "clone" (to clone the section of the page to update when the form is started) and "restore-clone" to put back the original contents after a cancel, or just "location" to totally refresh the page after a cancel.