Possible bug in knop form using -params

View: New views
2 Messages — Rating Filter:   Alert me  

Possible bug in knop form using -params

by Jolle Carlestam-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm having problems with knop_form using the -params param.

It's a form where I don't want any database action and the form object  
is created inside an inline.
When trying to load the field values using -params:
        #fForm -> loadfields(-params = lp_client_params);

this turns up empty:
        #fForm -> updatefields
That is, I get the field names but no values.
I've tracked it down to this piece of code. Turns out that if  
lasso_currentaction is something else than "nothing" the -param  
setting will be overwritten.

                if: (local_defined: 'params');
                        (self -> 'fieldsource') = 'params';
                        local: 'source'='params';
                        #_params = #params;
                else: (local_defined: 'database') && !(local_defined: 'inlinename');
                        if: #database -> type == 'database';
                                local: 'inlinename'=#database -> inlinename;
                        else: self -> 'database' -> type == 'database';
                                local: 'inlinename'=self -> 'database' -> inlinename;
                        /if;
                /if;
                       
                if: (local_defined: 'inlinename');
                        (self -> 'fieldsource') = 'database';
                        local: 'source'='params';
                        #_params=map;
                        records: -inlinename=#inlinename;
                                loop: (field_name: -count);
                                        #_params -> (insert: (field_name: loop_count)  =  (field:  
(field_name: loop_count)) );
                                /loop;
                                loop_abort;
                        /records;
                else: lasso_currentaction != 'nothing';
                        (self -> 'fieldsource') = 'database';
                        local: 'source'='database';
                else: (self -> 'fieldsource') == null;
                        (self -> 'fieldsource') = 'form';
                        #_params = array;
                        if: (local_defined: 'post');
                                #_params -> (merge: client_postparams);
                        /if;
                        if: (local_defined: 'get');
                                #_params -> (merge: client_getparams);
                        /if;
                        if: !(local_defined: 'post') && !(local_defined: 'get');
                                #_params -> (merge: client_postparams);
                                #_params -> (merge: client_getparams);
                        /if;
                /if;

----
I've change the above like this. No extensive testing done so I don't  
know if this breaks something else.

                if: (local_defined: 'params');
                        (self -> 'fieldsource') = 'params';
                        local: 'source'='params';
                        #_params = #params;
                else: (local_defined: 'database') && !(local_defined: 'inlinename');
                        if: #database -> type == 'database';
                                local: 'inlinename'=#database -> inlinename;
                        else: self -> 'database' -> type == 'database';
                                local: 'inlinename'=self -> 'database' -> inlinename;
                        /if;
// /if;
                       
// if: (local_defined: 'inlinename');
                else: (local_defined: 'inlinename'); // Changed by JC 090415
                        (self -> 'fieldsource') = 'database';
                        local: 'source'='params';
                        #_params=map;
                        records: -inlinename=#inlinename;
                                loop: (field_name: -count);
                                        #_params -> (insert: (field_name: loop_count)  =  (field:  
(field_name: loop_count)) );
                                /loop;
                                loop_abort;
                        /records;
                else: lasso_currentaction != 'nothing';
                        (self -> 'fieldsource') = 'database';
                        local: 'source'='database';
                else: (self -> 'fieldsource') == null;
                        (self -> 'fieldsource') = 'form';
                        #_params = array;
                        if: (local_defined: 'post');
                                #_params -> (merge: client_postparams);
                        /if;
                        if: (local_defined: 'get');
                                #_params -> (merge: client_getparams);
                        /if;
                        if: !(local_defined: 'post') && !(local_defined: 'get');
                                #_params -> (merge: client_postparams);
                                #_params -> (merge: client_getparams);
                        /if;
                /if;

HDB
Jolle

--
#############################################################
This message is sent to you because you are subscribed to
the mailing list <knop@...>.
To unsubscribe, E-mail to: <knop-off@...>
Send administrative queries to  <knop-request@...>
List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/

Re: Possible bug in knop form using -params

by Johan Solve-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Good call.

I think your logic got a bit warped though, I changed this line instead:

                else: lasso_currentaction != 'nothing';

into:
                else: (self -> 'fieldsource') == null && lasso_currentaction != 'nothing';



At 07.25 +0200 2009-04-15, Jolle Carlestam wrote:

>I'm having problems with knop_form using the -params param.
>
>It's a form where I don't want any database action and the form object is created inside an inline.
>When trying to load the field values using -params:
> #fForm -> loadfields(-params = lp_client_params);
>
>this turns up empty:
> #fForm -> updatefields
>That is, I get the field names but no values.
>I've tracked it down to this piece of code. Turns out that if lasso_currentaction is something else than "nothing" the -param setting will be overwritten.
>
> if: (local_defined: 'params');
> (self -> 'fieldsource') = 'params';
> local: 'source'='params';
> #_params = #params;
> else: (local_defined: 'database') && !(local_defined: 'inlinename');
> if: #database -> type == 'database';
> local: 'inlinename'=#database -> inlinename;
> else: self -> 'database' -> type == 'database';
> local: 'inlinename'=self -> 'database' -> inlinename;
> /if;
> /if;
>
> if: (local_defined: 'inlinename');
> (self -> 'fieldsource') = 'database';
> local: 'source'='params';
> #_params=map;
> records: -inlinename=#inlinename;
> loop: (field_name: -count);
> #_params -> (insert: (field_name: loop_count)  =  (field: (field_name: loop_count)) );
> /loop;
> loop_abort;
> /records;
> else: lasso_currentaction != 'nothing';
> (self -> 'fieldsource') = 'database';
> local: 'source'='database';
> else: (self -> 'fieldsource') == null;
> (self -> 'fieldsource') = 'form';
> #_params = array;
> if: (local_defined: 'post');
> #_params -> (merge: client_postparams);
> /if;
> if: (local_defined: 'get');
> #_params -> (merge: client_getparams);
> /if;
> if: !(local_defined: 'post') && !(local_defined: 'get');
> #_params -> (merge: client_postparams);
> #_params -> (merge: client_getparams);
> /if;
> /if;
>
>----
>I've change the above like this. No extensive testing done so I don't know if this breaks something else.
>
> if: (local_defined: 'params');
> (self -> 'fieldsource') = 'params';
> local: 'source'='params';
> #_params = #params;
> else: (local_defined: 'database') && !(local_defined: 'inlinename');
> if: #database -> type == 'database';
> local: 'inlinename'=#database -> inlinename;
> else: self -> 'database' -> type == 'database';
> local: 'inlinename'=self -> 'database' -> inlinename;
> /if;
>// /if;
>
>// if: (local_defined: 'inlinename');
> else: (local_defined: 'inlinename'); // Changed by JC 090415
> (self -> 'fieldsource') = 'database';
> local: 'source'='params';
> #_params=map;
> records: -inlinename=#inlinename;
> loop: (field_name: -count);
> #_params -> (insert: (field_name: loop_count)  =  (field: (field_name: loop_count)) );
> /loop;
> loop_abort;
> /records;
> else: lasso_currentaction != 'nothing';
> (self -> 'fieldsource') = 'database';
> local: 'source'='database';
> else: (self -> 'fieldsource') == null;
> (self -> 'fieldsource') = 'form';
> #_params = array;
> if: (local_defined: 'post');
> #_params -> (merge: client_postparams);
> /if;
> if: (local_defined: 'get');
> #_params -> (merge: client_getparams);
> /if;
> if: !(local_defined: 'post') && !(local_defined: 'get');
> #_params -> (merge: client_postparams);
> #_params -> (merge: client_getparams);
> /if;
> /if;
>
>HDB
>Jolle
>
>--
>#############################################################
>This message is sent to you because you are subscribed to
>the mailing list <knop@...>.
>To unsubscribe, E-mail to: <knop-off@...>
>Send administrative queries to  <knop-request@...>
>List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html
>Project homepage http://montania.se/projects/knop/
>Google Code has the latest downloads at http://code.google.com/p/knop/


--
     Johan Sölve    [FSA Member, Lasso Partner]
     Web Application/Lasso/FileMaker Developer
     MONTANIA SOFTWARE & SOLUTIONS
http://www.montania.se   mailto:joh-n@...
 (spam-safe email address, replace '-' with 'a')

--
#############################################################
This message is sent to you because you are subscribed to
the mailing list <knop@...>.
To unsubscribe, E-mail to: <knop-off@...>
Send administrative queries to  <knop-request@...>
List archive http://www.nabble.com/Knop-Framework-Discussion-f29076.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/