Hi folks,
I have a login page which need to call for a captcha modal (separated module, captcha is my own) when the login page "sign-in" button is hit, but I'm stuck at this point w/ several things and questions - the captcha will be used from several pages of the app :
* I must process the 2 captcha buttons "renew" & "submit" from the login page :
        a)- when hitting the "renew" button, why is it the login event that is triggered instead of the captcha one ? (wild guess : because a modal is a HTML part and not a page ?)
        b)- the "renew" button event does 2 things : closing the captcha and calling it again, but it doesn't work : it is closed but not re-launched, why is that ? (not any msg on the console and a ?PRINT() show the re-launch is executed)
        b2)- more strange, if I add an intermediate function into the captcha module that just call it and replace the captcha new call in the login page  btn event, it fail with this error msg :
{error,postback_request,
    {url,"localhost:8080/login"},
    {error,undef,
        [{captchb,renew,[],[]},
         {wf_core,run_websocket,1,[{file,"src/wf_core.erl"},{line,81}]},
         {nitrogen,ws_message_catched,1,[{file,"src/nitrogen.erl"},{line,69}]},
         {nitrogen,ws_message,3,[{file,"src/nitrogen.erl"},{line,59}]},
         {cowboy_simple_bridge_anchor,websocket_handle,2,
             [{file,
                  "src/cowboy_bridge_modules/cowboy_simple_bridge_anchor.erl"}, 
              {line,70}]},
         {cowboy_websocket,handler_call,6,
             [{file,"src/cowboy_websocket.erl"},{line,482}]},
         {cowboy_http,loop,1,[{file,"src/cowboy_http.erl"},{line,231}]},
         {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,226}]}]}}
         {proc_god_survey,check_jesses_work,1,[{"Jesse is not working enough}"]}
        c)- consequence of the 2 above questions, shall I move all the captcha mechanics into the login page, meaning I'll be obliged to repeat that for each and every page calling a captcha, which doesn't look very right ?
        d)- as it seems I don't have another solution than to loop the captcha from within itself, won't it create a memory leak, especially if the answer's wrong, in which case it'll redirect to the index page (or will it be GC as usual) ?
Jean-Yves
BTW, I modified coldstrap.erl to add another property (not closing it automatically when the user is clicking out of it or hit the escape key), it may be a good idea to add that to the next version (?) :
modal_body(Modalid, Title0, Body0, Footer0, Options) ->
    HasXButton = proplists:get_value(has_x_button, Options, false),
    %% ADDED: Forbid modal closure by clicking outside of it or hitting ESC
    HasDontCloseFromOutside = proplists:get_value(has_dont_close_from_outside, Options, false),
    DontCloseFromOutside = case HasDontCloseFromOutside of
        false  -> ""
        ; true -> "data-backdrop='static' data-keyboard='false'"
    end,
    %% /ADDED
    XButton = format_x_button(HasXButton),
    Title   = modal_header(Title0),
    Footer  = modal_footer(Footer0),
    %% ORG line replaced & move out of the way
    %%%%"<div class='modal fade' id=">>,Modalid,<<"role=dialog>
    [<<
        "<div class='modal fade' id=">>,Modalid,<<" role=dialog ">>,DontCloseFromOutside,<<">
[…]