Togglecheck

By Timothy Foster Timothy 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

Fancy HR Dividers - 07 Apr 2021 06:23
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


Rate this solution

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

rating: +4
page revision: 5, last edited: 17 Dec 2013 20:27
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License
Click here to edit contents of this page.
Click here to toggle editing of individual sections of the page (if possible). Watch headings for an "edit" link when available.
Append content without editing the whole page source.
Check out how this page has evolved in the past.
If you want to discuss contents of this page - this is the easiest way to do it.
View and manage file attachments for this page.
A few useful tools to manage this Site.
Change the name (also URL address, possibly the category) of the page.
View wiki source for this page without editing.
View/set parent page (used for creating breadcrumbs and structured layout).

AltStyle によって変換されたページ (->オリジナル) /