Various FlexForm options


Parameters you can add to the _form tag.



Change the html post action to a custom one

In some rare cases you might want to create a FlexForm, but not have FlexForm handle the post data. In that case use formtarget="your url here" to tell html form where to go when someone submits the data.

See example 1

Note: Keep in mind that this option will completely ignore FlexForm on form submission. No pages will be created or edited.


Show a custom message when form is successfully posted

It's sometimes handy to show a custom message when a form has been successfully posted, especially when after a post you return to the same form page.

See example 2


Redirect to this page after submitting the form

When a form is submitted FlexForm will return to the page the Form was submitted from. You can change it to go to another page ( like a thank-you page for example ) by setting mwreturn. mwreturn="Thank-you-page". Provide a URL (the localurl and fullurl magic words may come in handy).


Disable enter key for submitting a form

A HTML form usually gets submitted on pressing enter when there's like one text field. To disable that use the no_submit_on_return option. This will add some JavaScript to the form disabling form submission on typing an enter.

See example 3


Use reCaptcha Version 3 on a flexform

Have FlexForm use Google reCAPTCHA v3 to prevent spamming in a form.

You need to add you recaptcha key and secret in the configuration.

$wgFlexFormConfig['rc_site_key']   = ""; // reCaptcha site key
$wgFlexFormConfig['rc_secret_key'] = ""; // reCaptcha secret key

Then you can use

recaptcha-v3-action="action name"

Where action name is the name of the action to describe the form. It's an extra security measurement. You can choose your own name e.g. : contactform

See example 4

Note: reCAPTCHA v3 will not work when submitting the form through AJAX (mwidentifier="ajax")


Auto save forms on interval, after change or both

FlexForm autosave function allows for saving the open form in the background while someone is writing in it.

This feature has 3 options:

Save a form in the background on oninterval, on onchange or onboth. As off v1.1.28 onintervalafterchange has been added.

It support "normal" forms as well as a form with mwidentifier="ajax", meaning a form setup to be posted as an Ajax call. Also tested with TinyMCE ( tinymce extension ).

TinyMCE Note: WSForm will look for all elements that have a class name starting with "tinymce", as suggested by TinyMCE.

When using onboth, oninterval or onintervalafterchange a button will be added to the top of the form showing autosave interval is on. Clicking the button will turn interval saving off. When you turn it off and autosave is set to auto, the after change will still autosave. onintervalafterchange will add this button after a change has been detected.


The interval time and the after on change time can be set in the config file. When using interval or auto, the text for the button that appears above the form can be set in the config file.

To style the button to switch off and on the Interval saving classes are added to it in different states:

When on it will have the classes : btn btn-primary ws-interval-on

When off it will have the classes : btn btn ws-interval-off


On form create tag add autosave as parameter. e.g.

This will set autosave to auto.

<_form action="addToWiki" id="unique id per form" autosave=""></_form>

Set autosave to interval only :

<_form action="addToWiki" id="unique id per form" autosave="oninterval"></_form>

Set autosave to change only :

<_form action="addToWiki" id="unique id per form" autosave="onchange"></_form>

Note: A form needs to have an unique identifier set by its id

Set autosave to interval after change only : This will set the interval saving after a change has been detected. So it is basically the same as oninterval, except it won't start if there are no changes yet.

<_form action="addToWiki" id="unique id per form" autosave="onintervalafterchange"></_form>


Set the summary text shown in the recent changes and or contributions

This can be really handy to describe what form or action was responsible for the changes in the Wiki.

<_form action="addToWiki" setwikicomment="Edit user preference form" >
   Your flexform elements here


Have an extension do additional tasks with form values

You can create an extension for FlexForm that can do additonal tasks to a Form. See extension Docs for more information

<_form action="addToWiki" extension="<name of your extension" >
   Your flexform elements here


Example 1 : formtarget

<_form action="addToWiki" formtarget="" >
   Your flexform elements here

Example 2 : messageonsuccess

<_form action="addToWiki" messageonsuccess="Information posted, thanks!">
    Your flexform elements here

Example 3 : no_submit_on_return

<_form action="addToWiki" no_submit_on_return>
    Your flexform elements here

Example 4 : reCaptcha v3

<_form action="addToWiki"  recaptcha-v3-action="contactform">
    Your flexform elements here