Togglecheck

By Timothy FosterTimothy Foster

Description

At present, Wikidot's checkbox field for data forms will only display a 0 if unchecked or a 1 if checked. This can be rather unintuitive; for example, consider a page in which users are expected to document the abilities and skills of an Role Playing Game character. There may be a list of possible skills, like Double Strike or Indomitable, which the user may check or uncheck depending on whether the character has the skill.

Currently, though, using this method along with the %%form_data{field}%% yields the following:

Double Strike: 0
Indomitable: 1

This is obviously undesirable. Instead, you would want something that only shows the skill if it was checked, like so:

Indomitable

This can be easily achieved with the Togglecheck CSI.

If you find yourself using this, then you should definitely rate this wish up on Wikidot's feedback site!

Code

[[include :snippets:togglecheck
|fieldName=doublestrike
|checked=Double Strike
|unchecked=
]]
[[include :snippets:togglecheck
|fieldName=indomitable
|checked=Indomitable
|unchecked=
]]

Note: This snippet can only be used on a live _template page!

In action

You can try out this code by clicking on the following link:


Thanks to tsangk for this great snippet: conditional-blocks


text above inserted with:

[[include :snippets:if START |unique=1|type=equal|var1=%%name%%|var2=conditional-blocks]]
**##red|Thanks to tsangk for this great snippet:##** [[[code:conditional-blocks]]]
[[include :snippets:if END]]



Other snippets posted by Timothy Foster

Carousel - 24 May 2015 01:18
Modal Image - 01 May 2015 17:20
Bootstrap Image Box - 19 Jul 2014 01:27
Alternative Specific Users Only - 11 Dec 2013 18:04
Image Box - 10 Dec 2013 03:14
Toggle Tag - 19 Jul 2013 11:13
Hide Tags - 14 Feb 2013 21:35
Plurality Checker - 16 Jul 2012 03:21
Mini Chat Area - 15 May 2012 12:04
Table Alterations - 16 Feb 2012 01:45
Fancy <hr> Dividers - 15 Feb 2012 00:51


Rate this solution

If you think this solution is useful — rate it up!

rating: +2+x
Add a New Comment
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License