Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Checkbox not readable by wf:q/1

#58

From Fabian Król on the newsgroup:

I have simple code:
content() ->

   [
   #flash {},

   #checkbox {id=chb1, checked=true},
   #checkbox {id=chb2},

   #button { postback=accept }
   ].

event(accept) ->

   Chb1 = wf:q(chb1),
   Chb2 = wf:q(chb2),
   wf:flash(wf:f("~s ~s", [Chb1, Chb2])).

The behavior i would expect is to get information about checked/not
checked but i always receive value "on". It doesn't say anything about
the state of checkbox.

Of course i can remember the state in other place and react with
postback in checkbox object but it seems to by ugly ;)

Reported by Rusty Klophaus · April 28th, 2010 @ 07:54 AM

State: resolved
Milestone: 2.0.1
Assigned to: nobody

Activity

  1. Jesse Gumm
    Jesse Gumm

    I've posted a fix for this, as well as added support for the "value" attribute on the checkbox field.

    http://github.com/choptastic/nitrogen/commit/dce295e82d917310b2fde5...

    Assuming the following checkboxes

    [ #checkbox{id=fruit,value="apple",text="Apple"}, #checkbox{id=fruit,value="orange",text="Orange",checked=true}, #checkbox{id=fruit,value="banana",text="Banana",checked=true} ].

    wf:qs(fruit) would yield ["orange","banana"]

    This, to me, seems the appropriate way to handle checkboxes to stay consistent with HTML form submission.

    May 8th, 2010 @ 07:53 PM

  2. Rusty Klophaus
    Rusty Klophaus
    • State changed from new to resolved

    Merge changes from Jesse Gumm.

    June 14th, 2010 @ 06:50 PM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.