Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/choptastic/always_checkbox
An `#always_checkbox{}` element for Nitrogen
https://github.com/choptastic/always_checkbox
Last synced: 21 days ago
JSON representation
An `#always_checkbox{}` element for Nitrogen
- Host: GitHub
- URL: https://github.com/choptastic/always_checkbox
- Owner: choptastic
- Created: 2014-11-08T15:41:55.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-12-12T20:04:02.000Z (almost 8 years ago)
- Last Synced: 2024-10-08T15:25:08.760Z (about 1 month ago)
- Language: Erlang
- Size: 2.93 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# always_checkbox
Normal HTML checkboxes only submit their value when they are checked, but
sometimes you *want* a value to be submitted even if the box is unchecked.
This offers an alternative that will submit a value depending on the checked
status, customizable with `yes_value` and `no_value`.This creates an `#always_checkbox{}` element for the [Nitrogen Web
Framework](http://nitrogenproject.com)## Installing into a Nitrogen Application
Add it as a rebar dependency by adding into the deps section of rebar.config:
```erlang
{always_checkbox, "", {git, "git://github.com/choptastic/always_checkbox.git", {branch, master}}}
```### Using Nitrogen's built-in plugin installer (Requires Nitrogen 2.2.0)
Run `make` in your Application. The rest should be automatic.
### Manual Installation (Nitrogen Pre-2.2.0)
Run the following at the command line:
```shell
./rebar get-deps
./rebar compile
```Then add the following includes into any module requiring the form
```erlang
-include_lib("always_checkbox/include/records.hrl").
```## Usage
```erlang
#always_checkbox{
postback_id=my_checkbox,
yes_value="Yes it's checked",
no_value="Not checked",
checked=true
}.
```Note that this plugin works by using a hidden input to store
the intended values. That hidden input id, which is the one
you will wf:q(...), is set with the postback_id parameter.## License
Copyright (c) 2014, [Jesse Gumm](http://sigma-star.com/page/jesse)
([@jessegumm](http://twitter.com/jessegumm))MIT License