login('GET', [], Context) ->
    case proplists:get_value(user_no, boss_session:get_session_data(SessionID)) 
of
        undefined ->
            Form = boss_form:new(login_form, []),
            io:format("FORM: ~p~n~n", [Form:fields()]),
            {{ok, [{a, 'b'}, {form, Form}]}, Context};
        _ ->
            {{redirect, "/team_performance"}, Context}
    end;


It fails on the form initialization line.

On Monday, 19 February 2018 12:27:28 UTC+3, Nick Garanko wrote:
>
> Could you share some code, please?
>
> -Nick
>
>
> On 19 February 2018 at 07:49:49, Aurlus Ismael (aurlus...@twigafoods.com 
> <javascript:>) wrote:
>
> Thanks for that Nick. I already had that as I was getting the error. I 
> changes the position of boss_form in rebar.config and now I have a 
> different issue: 
>
> 09:44:49.807 [error] Unhandled Error: error:function_clause Stacktrace: 
> [{boss_web_controller_handle_request,process_result,[{boss_app_info,
>                                                     asm_dashboard,[],
>                                                     "/static","/doc",all,
>                                                     
> [{asm_dashboard_01_news,
>                                                       [0]}],
>                                                     <0.295.0>,<0.296.0>,
>                                                     <0.298.0>,<0.299.0>,
>                                                     ["asm","greeting"],
>                                                     [],
>                                                     
> ["asm_dashboard_asm_controller",
>                                                     
>  "asm_dashboard_dispatch_controller",
>                                                     
>  "asm_dashboard_greeting_controller"]},
>                                                   
>  {sbw,cowboy_simple_bridge,
>                                                     {cowboy_bridge,
>                                                     
>  #Ref<0.3139497015.3672375297.49461>},
>                                                     false,[],[],[],none,
>                                                     [{<<"host">>,
>                                                       <<"127.0.0.1:8001
> ">>},
>                                                      {<<"connection">>,
>                                                       <<"keep-alive">>},
>                                                      {<<"cache-control">>,
>                                                       <<"max-age=0">>},
>                                                      {<<"user-agent">>,
>                                                       <<"Mozilla/5.0 (X11; 
> Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 
> Safari/537.36">>},
>                                                     
>  {<<"upgrade-insecure-requests">>,
>                                                       <<"1">>},
>                                                      {<<"accept">>,
>                                                       
> <<"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8">>},
>                                                     
>  {<<"accept-encoding">>,
>                                                       <<"gzip, deflate, 
> br">>},
>                                                     
>  {<<"accept-language">>,
>                                                       
> <<"en-US,en;q=0.9">>},
>                                                      {<<"cookie">>,
>                                                       
> <<"_ga=GA1.1.954076321.1512824233; __zlcmid=jtgxPXLkmmbTy0; 
> csrftoken=QcRQOtrXSldsDpCURTVHygYbLhItucLn; 
> sessionid=rpwb5m5j7dlttzrjosx8t3jimmv3qoy6; 
> _boss_session=d1718a457590314fc6bd530c6cdeb9fd62d784c5">>}],
>                                                     [{<<"_ga">>,
>                                                       
> <<"GA1.1.954076321.1512824233">>},
>                                                      {<<"__zlcmid">>,
>                                                       
> <<"jtgxPXLkmmbTy0">>},
>                                                      {<<"csrftoken">>,
>                                                       
> <<"QcRQOtrXSldsDpCURTVHygYbLhItucLn">>},
>                                                      {<<"sessionid">>,
>                                                       
> <<"rpwb5m5j7dlttzrjosx8t3jimmv3qoy6">>},
>                                                      {<<"_boss_session">>,
>                                                       
> <<"d1718a457590314fc6bd530c6cdeb9fd62d784c5">>}],
>                                                     
> {response,200,[],[],[]}},
>                                                    {{ok,
>                                                      [{a,b},
>                                                       {form,
>                                                        {login_form,[],[...
>
>
>
> On Sunday, 18 February 2018 12:33:13 UTC+3, Nick Garanko wrote: 
>>
>> Ouch, forgot to mention:
>>  You have to add following into deps section of rebar.config
>> ```
>> {boss_form, ".*", {git, “https://github.com/ngaranko/boss_form.git";, 
>> "HEAD”}}
>> ```
>> https://github.com/ngaranko/r2d2/blob/master/rebar.config#L3 (here using 
>> git url for dev reasons)
>>
>> And then run: ./rebar get-deps compile
>> I’ve just pushed an update to controller code in r2d2 repo that fixes a 
>> bug in form processing, FYI.
>>
>> -Nick
>>
>>
>>
>> On 17 February 2018 at 20:41:37, Aurlus Ismael (aurlus...@twigafoods.com) 
>> wrote:
>>
>> Hi Nick, 
>>
>> Thanks for your library and the examples. However, I'm having an 
>> undefined stacktrace when I try initiating the form.
>>
>> Error in controller error:undef Stacktrace: 
>> [{boss_form,new,[login_form,[]],[]}...]
>>
>> Any suggestions to get past this?
>>
>> On Friday, 16 February 2018 16:48:51 UTC+3, Nick Garanko wrote: 
>>>
>>> Heya Aurlus, 
>>>
>>> Long ago I build basic implementation of Django-alike form validation: 
>>> https://github.com/ngaranko/boss_form
>>> Example: 
>>>  - Controller: 
>>> https://github.com/ngaranko/r2d2/blob/master/src/controller/r2d2_public_controller.erl
>>>  - Form: 
>>> https://github.com/ngaranko/r2d2/blob/master/src/lib/login_form.erl
>>>  - View: 
>>> https://github.com/ngaranko/r2d2/blob/master/src/view/public/login.html
>>>
>>> Unfortunately long since had no time/will to contribute in there, maybe 
>>> it's good time now to return to it. Thus: will be happy to assist extending 
>>> it.
>>>
>>> -Nick
>>>
>>> Op vrijdag 16 februari 2018 08:11:48 UTC+1 schreef Aurlus Ismael: 
>>>>
>>>> Thanks for the prompt response. I'll be waiting for your response.
>>>>
>>>> On Friday, 16 February 2018 10:08:31 UTC+3, Aurlus Ismael wrote: 
>>>>>
>>>>> Hi all, 
>>>>>
>>>>> I'm new to Erlang and ChicagoBoss. I've been looking around to see if 
>>>>> there's a way to do form validation e.g test if a particular field is 
>>>>> empty, and return the form
>>>>> with the relevant errors. Is there a way to do this?
>>>>>
>>>> --
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "ChicagoBoss" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/chicagoboss/4mu7obiiHqk/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> chicagoboss...@googlegroups.com.
>> Visit this group at https://groups.google.com/group/chicagoboss.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/chicagoboss/fd4d671e-85b7-42f0-9548-1d4bf354b420%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/chicagoboss/fd4d671e-85b7-42f0-9548-1d4bf354b420%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>> --
> You received this message because you are subscribed to a topic in the 
> Google Groups "ChicagoBoss" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/chicagoboss/4mu7obiiHqk/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> chicagoboss...@googlegroups.com <javascript:>.
> Visit this group at https://groups.google.com/group/chicagoboss.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/chicagoboss/329f6220-ada2-4736-bfdf-5631f78a9fa9%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/chicagoboss/329f6220-ada2-4736-bfdf-5631f78a9fa9%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to chicagoboss+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/chicagoboss.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/chicagoboss/a5da8277-caf9-40ac-9910-327357455d4f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to