7

Is there a way to insert an HTML checkbox in Mediawiki syntax?

<input> doesn't appear on their list of blessed tags, so I can't just insert it.

(FWIW, this is for a private documentation page which is a checklist, and I want to keep track of where I am as I go through it.)

4 Answers 4

7

This is a quick way to add something like a checkbox if it fits you:

<span style="font-size:21px">☐</span> 

Basically, it uses the 'hollow medium square' character "□" which is similar to a checkbox, but it is too small in its original form, so I had to apply some CSS to enlarge it.

To check it, replace it with a 'tick' mark. (✓, ✔, ☑, etc.)

Adjust the values to your needs.

2
  • Here's an slightly larger alternative to add to the answer. It's called 'white medium square': ◻
    – wandersick
    Apr 24, 2013 at 14:57
  • Don't know why this one is downvoted so low. IF you want a display-only checkbox and you don't have admin-access, this is the perfect/only solution. Jul 30, 2017 at 15:18
2

These tags are just free-form wiki text, like markdown on SO, and are provided for formatting but not input. To add input html elements, or forms, use one of the MEdiawiki extensions, such as semantic forms or simple forms. Check this URL out for an overview of how form content is handled in Mediawiki.

Good luck.

0

I just found another way to do it. It involves editing your mediawiki source, and depending which version you have, may not work just the same. This is for 1.15.3.

In the file sanitizer.php, near the end of the function setupAttributeWhitelist() add this line to the list

'input'      => array('type'),

Then find the function removeHTMLtags and add this to the end of the $htmlsingle (and for 1.19.4 and maybe an intermediate version, the $htmlsingleonly) array:

, 'input'
1
  • I upgraded to 1.22.4 and it stopped working. I'd forgotten that I'd done this tweak, so I've just come across my own answer! I've also updated it. Mar 21, 2014 at 10:00
0

This renders a nice list of checkboxes:

== My Wiki Header ==

Here's an example checklist:
<html>
<input type="checkbox"> Item A.<br>
<input type="checkbox"> Item B.<br>
<input type="checkbox"> Item C.<br>
</html>

I don't recall having any special configuration on my wiki. Of course the checkboxes won't do anything, they're just for the looks.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .