On Tue, 30 Oct 2012 11:06:23 GMT, denizzzka wrote:
I.e., variable and tag:
-bool checkboxvalue = false;
input(name="nameof_checkbox", required, type="checkbox")but sometimes (if checkbox_value == true) it should be:
input(name="nameofcheckbox", required, type="checkbox", checked)
(for example, if I show form again and want to help user with values what he entered earlier)
It should always be two differend tags or I can write something like:
input(name="nameofcheckbox", required, type="checkbox" (checkbox_value ? ", checked", "") )
?
Right now it's possible to use string interpolations to use dynamic attribute values:
input(name='subject', type='text', value='#{req.form["subject"]}')
Unfortunately boolean attributes are currently only settable in a static way, the proposed syntax to handle them is this:
input(name='subject', type='text', value=(req.form["subject"]))
input(name='enabled', type='checkbox', checked=("enabled" in req.form ? true : false))
Until this is implemented, the only option is to use an if statement or hack around with inline HTML:
- if( "enabled" in req.form )
input(name='enabled', type='checkbox', checked)
- else
input(name='enabled', type='checkbox')
|<input name="enabled" type="checkbox"#{"enabled" in req.form ? ` checked="checked"` : ``}>
A bit annoying, I know, but I didn't get to this yet...