wf:wire()-ing an on click #event{} causes the event not to fire
Reported by Brian O | April 22nd, 2010 @ 04:56 PM
Here is a fairly minimal example:
-module(test).
-include_lib ("nitrogen/include/wf.hrl").
-compile(export_all).
main() -> #template{file="./site/templates/template.html"}.
body() ->
PanelId=wf:temp_id(),
[#link{text="Add", postback={add, PanelId}},
#panel{id=PanelId}].
event(click) ->
io:format("click~n");
event({add, PanelId}) ->
Id = wf:temp_id(),
wf:wire(Id, #event{type=click, postback=click}),
wf:update(PanelId, #link{id=Id, text="Click"}).
In Nitrogen 1.0, if you click Add and then Click, the server prints "click".
In Nitrogen 2.0, the postback is no longer triggered in this case, though I think we would expect it to be.
Instead we can do
event({add, PanelId}) ->
wf:update(PanelId, #link{text="Click", actions=#event{type=click, postback=click}}).
And it does work in Nitrogen 2.0. The two should function equivalently, though.
Comments and changes to this ticket
-
Rusty Klophaus June 29th, 2010 @ 08:00 PM
- Milestone cleared.
- Milestone order changed from 0 to 0
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.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
Nitrogen Web Framework for Erlang