A simple #yesno
element dropdown box abstraction for boolean yes or no
dropdown for the Nitrogen Web Framework
Add it as a rebar dependency by adding into the deps section of rebar.config:
{sigma_yesno, ".*", {git, "git://github.com/choptastic/sigma_yesno.git", {branch, master}}}
Run make
in your Application. The rest should be automatic.
Run the following at the command line:
./rebar get-deps
./rebar compile
Then add the following includes into any module requiring the form
-include_lib("sigma_form/include/records.hrl").
#sigma_yesno{
yes_text="Yeah, Sure",
no_text="Heck No",
value=AreYouAwesome
}
yes_text
: The text for the "Yes" valueno_text
: The text for the "No" valuevalue
: The boolean value to determine which value is selected. Please note that this follows a somewhat "PHP-ish" approach. The following values evaluate to false:false
,"false"
,"no"
,no
,"0"
,0
,""
(empty list), andundefined
. All others evaluate to true.
As far as postback values, the "yes" value will be the text "1", and the "no" value will be text "0".
Copyright (c) 2013-2014, Jesse Gumm (@jessegumm)
MIT License