According to the documentation, the checkbox field type:
Defines a checkbox field, stored in the form data as 0 or 1.
I would like to see this enhanced via a couple of new attributes:
Attribute | Allowed values | Default | Description |
---|---|---|---|
true: | Any text | 1 | Stores this text when the checkbox is ticked |
false: | Any text | 0 | Stores this text when the checkbox is not ticked |
Currently the stored boolean values are a bit… well, binary. They're not particularly practical.
Example
With this proposed syntax, suppose the data form used this syntax:
%%created_by_linked%% would like a **%%form_data{chicken}%%** sandwich with **%%form_data{salami}%%**.
====
[[form]]
fields:
chicken:
label: Do you want chicken?
type: checkbox
true: chicken
false: salad
salami:
label: How about extra salami?
type: checkbox
default: 1
true: extra salami
false: no salami
[[/form]]
This in turn would display the following:
James Kanjo would like a chicken sandwich with no salami.
This is much better than displaying:
James Kanjo would like a 1 sandwich with 0.
But a 1 sandwich sounds delicious!
Totally agree - ones and zeros aren't very human friendly.
BMC Creative | RoaringApps | @brycecammo
You can achieve the "Chicken sandwich" and "no salami" using CSS already.
But I definitely agree that this needs to be officially supported, without the need to resort to CSS as a solution. It makes Wikidot even more user-friendly for new users.
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server | NEW: Wikiroo, backup tool (in development)
It also allows for better programming. In live templates, I've resorted to using code such as:
Which means I need to create two pages named “sandwich-0” and “sandwich-1”. I would much prefer to include pages named “chicken” and “salad” rather than binary sandwiches.
Achieving this is not possible with CSS.
Kenneth Tsang (@jxeeno)
Allow me to rephrase:
Achieving “the specifying the name of a page to include rather than a number” is not possible with CSS.
You raise a good point - re: including pages based on this.
What I was referring to above was a CSS solution much like the one tsangk posted.
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server | NEW: Wikiroo, backup tool (in development)
:)
Kenneth Tsang (@jxeeno)