Name
_form
Type
_form
Synopsis
Various FlexForm options
Description
Parameters you can add to the _form tag.
Parameters
formtarget
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.
messageonsuccess
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
no_submit_on_return
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
recaptcha-v3-action
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
The 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")
setwikicomment
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
</_form>
Examples
Example 1 : formtarget
<_form action="addToWiki" formtarget="https://example.com/handleform.php" >
Your flexform elements here
</_form>
Example 2 : messageonsuccess
<_form action="addToWiki" messageonsuccess="Information posted, thanks!">
Your flexform elements here
</_form>
Example 3 : no_submit_on_return
<_form action="addToWiki" no_submit_on_return>
Your flexform elements here
</_form>
Example 4 : reCaptcha v3
<_form action="addToWiki" recaptcha-v3-action="contactform">
Your flexform elements here
</_form>
Note
Links
https://developers.google.com/recaptcha/docs/v3