Difference between revisions of "Boolean field"
(→Properties) |
|||
Line 13: | Line 13: | ||
| '''input_style''' || checkbox || May be one of (menu<nowiki>|</nowiki>radio<nowiki>|</nowiki>checkbox). This controls how the field is rendered in input forms. | | '''input_style''' || checkbox || May be one of (menu<nowiki>|</nowiki>radio<nowiki>|</nowiki>checkbox). This controls how the field is rendered in input forms. | ||
− | + | "checkbox" gives just a single HTML checkbox which can be ticked or not. It looks a bit rubbish, and does not provide a way to indicate an "unset" value. | |
+ | |||
+ | "menu" gives an HTML "select" menu with two or three options. The third is "unspecified" and only available if the field is not a required field. | ||
+ | |||
+ | "radio" gives an HTML radio buttons interface. It renders an html phrase with the true and false radio buttons placed in the phrase using pins. If the field is not required then a third radio button for "unspecified" appears below this. | ||
+ | |||
|} | |} | ||
== Required Phrases == | == Required Phrases == | ||
+ | |||
+ | === menu style === | ||
+ | |||
+ | If you use input_style=>"menu" then you need two phrases of the type: | ||
+ | |||
+ | '''datasetid''' + "_fieldopt_" + '''fieldname''' + "_TRUE" | ||
+ | '''datasetid''' + "_fieldopt_" +' ''fieldname''' + "_FALSE" | ||
+ | |||
+ | These control the display of the items in the menu. | ||
+ | |||
+ | Example: | ||
+ | |||
+ | <epp:phrase id="eprint_fieldopt_myboolean_TRUE">Certainly!</epp:phrase> | ||
+ | <epp:phrase id="eprint_fieldopt_myboolean_FALSE">No way!</epp:phrase> | ||
+ | |||
+ | === radio style === | ||
+ | |||
+ | This uses a single phrase with two pins in it to indicate the locations of the radio buttons. The phrase id is: | ||
+ | |||
+ | '''datasetid''' + "_radio_" + '''fieldname''' | ||
+ | |||
+ | We suggest placing a <label> element around the radio button and it's title - as well as being good practice, this also means that in some browsers clicking on the text will select the button. | ||
+ | |||
+ | For example: | ||
+ | |||
+ | <epp:phrase id="eprint_radio_myboolean"><label><epc:pin name="true"/>Yes, I like cheese.</label><br/><label><epc:pin name="false"/>No, cheese is bad.</label></epp:phrase> |
Revision as of 17:16, 9 January 2007
Description
Describes a simple yes/no value. Unless the field has the required property set, it can actually have a third setting of unset. This can be useful as it distinguishes between a "False" and a "don't know/haven't filled this in yet". For example when asking if a paper is refereed, this is a boolean field. However it's not required as often someone isn't sure, and does not want to click "no" when that's not necessarily true.
Properties
name | default | description |
input_style | checkbox | May be one of (menu|radio|checkbox). This controls how the field is rendered in input forms.
"checkbox" gives just a single HTML checkbox which can be ticked or not. It looks a bit rubbish, and does not provide a way to indicate an "unset" value. "menu" gives an HTML "select" menu with two or three options. The third is "unspecified" and only available if the field is not a required field. "radio" gives an HTML radio buttons interface. It renders an html phrase with the true and false radio buttons placed in the phrase using pins. If the field is not required then a third radio button for "unspecified" appears below this. |
Required Phrases
If you use input_style=>"menu" then you need two phrases of the type:
datasetid + "_fieldopt_" + fieldname + "_TRUE" datasetid' + "_fieldopt_" +' fieldname + "_FALSE"
These control the display of the items in the menu.
Example:
<epp:phrase id="eprint_fieldopt_myboolean_TRUE">Certainly!</epp:phrase> <epp:phrase id="eprint_fieldopt_myboolean_FALSE">No way!</epp:phrase>
radio style
This uses a single phrase with two pins in it to indicate the locations of the radio buttons. The phrase id is:
datasetid + "_radio_" + fieldname
We suggest placing a <label> element around the radio button and it's title - as well as being good practice, this also means that in some browsers clicking on the text will select the button.
For example:
<epp:phrase id="eprint_radio_myboolean"><label><epc:pin name="true"/>Yes, I like cheese.</label>
<label><epc:pin name="false"/>No, cheese is bad.</label></epp:phrase>