[web2py] Re: Two forms

2017-09-23 Thread 黄祥
yes, you are right, my bad, my old code have a race condition because of assigned with max id *e.g.* *have a race condition (don't use it if transaction is high)* id_max = db.order.id.max() maxID = db(db.order).select(id_max).first()[id_max] order_id = int(maxID) + 1 if maxID else 1

[web2py] Re: Two forms

2017-09-22 Thread T.R.Rajkumar
The order table id will be returned by the insert statement. There will be no race. We can use the returned id in items table. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) -

[web2py] Re: Two forms

2017-09-22 Thread 黄祥
face this before, usually created the form with web2py components 1 for items (up first), save the value of items on the sessions then another component for order table (below to submit all the data (data in sessions input to items and order data) during the form.process() or form.validate()

Re: [web2py] Re: two forms submitted into the same cotroller

2014-09-10 Thread Andrey Khmelevskiy
Thank Cliff and Massimo for your help. I have finally make in very similar fission: I have 2 divs, controller1 with static form with id=1 that inserted in div1, another controller2 that triggers by w2p_component (ajax) and generates form with id=2 and inserted to div2 but all input fields of this

[web2py] Re: two forms submitted into the same cotroller

2014-09-02 Thread Cliff Kachinske
Here is what I do. Your page should have one form only. Make 2 divs. Top div has your fixed fields including the one that triggers the variable content. Use jquery to catch the change event for the field. When the field changes send an Ajax request to the server. Let the server build the

[web2py] Re: two forms submitted into the same cotroller

2014-08-31 Thread Andrey K
Thanks Massimo. Here is my reformatted question(hope it will be more understandable): I want to present two input sets of information coming from server into two sections of the same view (div1 and div2). First input set is generated based on user choice control, that presented at the

[web2py] Re: two forms submitted into the same cotroller

2014-08-31 Thread Massimo Di Pierro
This helps but I still have some questions... where is form? what is tab1? is this used the output of two generated SQLFORM? or the actual source view? On Sunday, 31 August 2014 14:45:02 UTC-5, Andrey K wrote: Thanks Massimo. Here is my reformatted question(hope it will be more

[web2py] Re: two forms submitted into the same cotroller

2014-08-30 Thread Andrey K
Hi Massimo, Here is my dilemma: I have one view with 3 tabs (DIVS), where I would like to have one tab for user tool selection and two forms in 2 separated tabs(DIVs) : 1)static form and 2)dynamic form(generated based on user selection in first tab). Also I would like to submit all information

[web2py] Re: two forms submitted into the same cotroller

2014-08-30 Thread Massimo Di Pierro
I believe your problem is the XY problem. http://mywiki.wooledge.org/XyProblem Y = submitting to forms to the same controller. Do no ask about Y. What it your original problem X for which you think Y is a good solution? On Saturday, 30 August 2014 15:24:16 UTC-5, Andrey K wrote: Hi Massimo,

[web2py] Re: two forms submitted into the same cotroller

2014-08-29 Thread Massimo Di Pierro
Something is wrong here. Can you explain at higher level what are you trying to achieve? On Friday, 29 August 2014 16:10:59 UTC-5, Andrey K wrote: Dear list, I have two related questions: 1. Basically I have one view (C) which contains two forms A and B. The dynamic form A is created by

Re: [web2py] Re: Two forms, one page

2012-03-21 Thread Larry G. Wapnitsky
Thanks, Niphlod pbreit. Still learning, and asking questions is how I do it. I'll work on your suggestions f FYI, Niphlod - this is the same app as in the other thread. On 3/20/2012 5:38 PM, Niphlod wrote: why not using SQLFORM.factory for having one form for all the data ? in the

[web2py] Re: Two forms, one page

2012-03-21 Thread Cliff
Another approach, the one that I use, is to hide the various forms behind accordion folds. Or on different tabs. In either case, update the fields on the tab or fold being closed to avoid losing input. You can use ajax for this. On Mar 21, 12:16 am, weheh richard_gor...@verizon.net wrote:

[web2py] Re: Two forms, one page

2012-03-20 Thread pbreit
I think you're going to run into problems in Web2py since even if you use Custom Forms (http://web2py.com/books/default/chapter/29/7#Custom-forms) you're going to have two conflicting security keys (hidden fields to prevent CSRF attacks). If you're able to paint the form correctly in the view,

[web2py] Re: Two forms, one page

2012-03-20 Thread Niphlod
why not using SQLFORM.factory for having one form for all the data ? in the controller logic, then, something like for f in form.vars.multiple_field: db.mysqltable.validate_and_insert(foo=form.vars.foo, bar=form.vars.bar, uniquefield=f) should do the job. With no example model

[web2py] Re: Two forms, one page

2012-03-20 Thread weheh
I think you're going to have some trouble with this. Your best bet is to go with SQLFORM.factory. problem is, you lose your nice CRUD functionality. But it gives you complete control. Another approach, the one that I use, is to hide the various forms behind accordion folds. That way, you only

[web2py] Re: Two forms on one page with custom forms

2011-05-23 Thread contatogilson...@gmail.com
I found the problem and created a slice: http://web2pyslices.com/main/slices/take_slice/133 _ *Gilson Filho* *Web Developer http://gilsondev.com* 2011/5/23 contatogilson...@gmail.com contatogilson...@gmail.com Hello, Tailored I'm a system that