(Admin) |
|||
Line 1: | Line 1: | ||
+ | ===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.'' | ||
+ | <hr> | ||
+ | '''messageonsuccess ''': Show a custom message when form is succesfully 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 | ||
+ | <hr> | ||
+ | '''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 | ||
+ | <hr> | ||
+ | '''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 configuraton. | ||
+ | <syntaxhighlight lang="php"> | ||
+ | $wgFlexFormConfig['rc_site_key'] = ""; // reCaptcha site key | ||
+ | $wgFlexFormConfig['rc_secret_key'] = ""; // reCaptcha secret key | ||
+ | </syntaxhighlight> | ||
+ | The you can use <syntaxhighlight lang="html">recaptcha-v3-action="action name"</syntaxhighlight> | ||
+ | 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")'' | ||
+ | |||
+ | ===Example=== | ||
+ | Example 1 : formtarget | ||
+ | <syntaxhighlight lang="html"> | ||
+ | <_form action="addToWiki" formtarget="https://example.com/handleform.php" > | ||
+ | Your flexform elements here | ||
+ | </_form> | ||
+ | </syntaxhighlight> | ||
+ | Example 2 : messageonsuccess | ||
+ | <syntaxhighlight lang="html"> | ||
+ | <_form action="addToWiki" messageonsuccess="Information posted, thanks!"> | ||
+ | Your flexform elements here | ||
+ | </_form> | ||
+ | </syntaxhighlight> | ||
+ | Example 3 : no_submit_on_return | ||
+ | <syntaxhighlight lang="html"> | ||
+ | <_form action="addToWiki" no_submit_on_return> | ||
+ | Your flexform elements here | ||
+ | </_form> | ||
+ | </syntaxhighlight> | ||
+ | Example 4 : reCaptcha v3 | ||
+ | <syntaxhighlight lang="html"> | ||
+ | <_form action="addToWiki" no_submit_on_return> | ||
+ | Your flexform elements here | ||
+ | </_form> | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | ===Note=== | ||
+ | |||
+ | ===Links=== | ||
+ | https://developers.google.com/recaptcha/docs/v3 |
Revision as of 16:24, 15 February 2022
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 succesfully 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 configuraton.
$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")
Example
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" no_submit_on_return>
Your flexform elements here
</_form>
Note
Links
https://developers.google.com/recaptcha/docs/v3