[web2py] Re: sqlform insert row id

2021-07-13 Thread Dave S
On Friday, July 2, 2021 at 12:50:02 AM UTC-7 Clemens wrote: > You can use validate() instead of process(): > if form.validate(): > ... > new_id = db.table.insert(...) > ... > > > http://web2py.com/books/default/chapter/29/07/forms-and-validators#The-process-and-validate-methods > > Tha

[web2py] Re: sqlform insert row id

2021-07-02 Thread Clemens
You can use validate() instead of process(): if form.validate(): ... new_id = db.table.insert(...) ... http://web2py.com/books/default/chapter/29/07/forms-and-validators#The-process-and-validate-methods Regards Clemens On Thursday, July 1, 2021 at 8:47:34 PM UTC+2 snide...@gmail.com

Re: [web2py] Re: sqlform insert row id

2021-07-01 Thread Javier Pepe
http://web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM-and-insert-update-delete In form.vars.id store Last ID inserted El jue., 1 de julio de 2021 15:47, Dave S escribió: > > > On Wednesday, June 30, 2021 at 11:35:29 PM UTC-7 Clemens wrote: > >> the insert returns the id of

[web2py] Re: sqlform insert row id

2021-07-01 Thread Dave S
On Wednesday, June 30, 2021 at 11:35:29 PM UTC-7 Clemens wrote: > the insert returns the id of the new record. > > new_id = db.table.insert(...) > > Have a try! > Well, yes, if you do the insert yourself, but when you're doing SQLFORM, it will do the insert. So you need it to return the new r

[web2py] Re: sqlform insert row id

2021-06-30 Thread Clemens
the insert returns the id of the new record. new_id = db.table.insert(...) Have a try! On Wednesday, June 30, 2021 at 11:51:08 PM UTC+2 snide...@gmail.com wrote: > If SQLFORM.process() accepts the form and does an insert, is there a > variable the controller or view can use to get the id of th

Re: [web2py] Re: SQLFORM keepvalues - only 1 field

2020-05-07 Thread mostwanted
Nice one On Thursday, April 30, 2020 at 9:14:48 PM UTC+2, Scott Hunter wrote: > > Would this do the job? > > form = SQLFORM.factory(*fields) > if form.process().accepted: > # update the database here > form2 = SQLFORM.factory(*fields) > form2.vars['state'] = form.v

[web2py] Re: SQLFORM with extra_fields

2020-05-01 Thread Jim S
S, I'm wondering if this is a bug in web2py. In the traceback above you can see the error is on line 1505 in sqlhtml.py. In looking at the code, it appears as though it is just setting the default value for each field based on the record that was retrieved. Here is that block of code: if

[web2py] Re: SQLFORM with extra_fields

2020-05-01 Thread Jim S
Clemens Thanks for this. Have you ever used extra_fields in SQLFORM? I'm wondering what it is for if it doesn't work the way I'm using it. -Jim On Friday, May 1, 2020 at 1:16:36 PM UTC-5, Clemens wrote: > > Hi Jim, > > I've solved it as follows (for an additional field to select the > corres

[web2py] Re: SQLFORM with extra_fields

2020-05-01 Thread Clemens
Hi Jim, I've solved it as follows (for an additional field to select the corresponding business unit, here stored in a dictionary): biz_unit = TR(TD(LABEL(T('Responsible'), XML('  '))), \ TD(SELECT(_name='biz_unit', value='', *[OPTION(biz_unit_title, _value=biz_unit_dict[biz_unit_title]) \ for

Re: [web2py] Re: SQLFORM keepvalues - only 1 field

2020-04-30 Thread Jim S
Wow, that is clever! And, works just how I want it to. Thanks so much for the pointer. -Jim On Thursday, April 30, 2020 at 2:14:48 PM UTC-5, Scott Hunter wrote: > > Would this do the job? > > form = SQLFORM.factory(*fields) > if form.process().accepted: > # update the database

Re: [web2py] Re: SQLFORM keepvalues - only 1 field

2020-04-30 Thread Scott Hunter
Would this do the job? form = SQLFORM.factory(*fields) if form.process().accepted: # update the database here form2 = SQLFORM.factory(*fields) form2.vars['state'] = form.vars.state form2.process() else: form2 = form return dict(form

Re: [web2py] Re: SQLFORM keepvalues - only 1 field

2020-04-30 Thread Jim S
Here is what I'm talking about: def update_something(): fields = [Field('name'), Field('address', 'text'), Field('city'), Field('state'), Field('zip_code')] form = SQLFORM.factory(*fields) if form.process().accepted: #

Re: [web2py] Re: SQLFORM keepvalues - only 1 field

2020-04-30 Thread Scott Hunter
Isn't "the next time through the method" when there is a new submission, which would have the saved value in it (unless the user changed it)? Maybe a sample of your code would make things clearer. On Thursday, April 30, 2020 at 1:21:53 PM UTC-4, Jim S wrote: > > Yes, but I need that value on th

Re: [web2py] Re: SQLFORM keepvalues - only 1 field

2020-04-30 Thread Jim Steil
Yes, but I need that value on the next time through the method. Therefore I have to save it to my session and grab it the next time in. Am I missing something? On Thu, Apr 30, 2020 at 12:19 PM Scott Hunter wrote: > Since the value in question is part of the current submission, isn't the > valu

Re: [web2py] Re: SQLFORM keepvalues - only 1 field

2020-04-30 Thread Scott Hunter
Since the value in question is part of the current submission, isn't the value available in form.vars? - Scott On Thursday, April 30, 2020 at 12:54:02 PM UTC-4, Jim S wrote: > > I was hoping to avoid those tricks. I too have done this by storing > values in the session to be redisplayed. I wa

Re: [web2py] Re: SQLFORM keepvalues - only 1 field

2020-04-30 Thread Jim Steil
I was hoping to avoid those tricks. I too have done this by storing values in the session to be redisplayed. I was hoping that the keepopts argument to SQLFORM would allow you to specify which fields to keep, but it seems that is used for something else. On Thu, Apr 30, 2020 at 11:48 AM Scott Hu

[web2py] Re: SQLFORM keepvalues - only 1 field

2020-04-30 Thread Scott Hunter
I recall doing this by "pre-populating" the field you want to keep with the old value. - Scott On Thursday, April 30, 2020 at 11:10:42 AM UTC-4, Jim S wrote: > > Does anyone know how I can have a form 'keepvalues' but only keep one > specific field value? I don't want it to keep the values for

Re: [web2py] Re: SQLFORM labels and input boxes overlapping

2020-04-17 Thread Jon Subscripted
Thanks Dave, I'll check it out! Libre de virus. www.avast.com <#DAB4FAD8-2DD7-

[web2py] Re: SQLFORM labels and input boxes overlapping

2020-04-16 Thread Dave S
On Thursday, April 16, 2020 at 8:11:41 AM UTC-7, Jonsubs wrote: > > Hi everyone, > In some of my views using SQLFORM, specially when the label text is not > short, the input box overlaps and covers part of the label text. > > How can I avoid this? > > As this is automatically generated HTML, I d

[web2py] Re: SQLFORM CSS DESIGN

2020-04-05 Thread Maurice Waka
I just got an answer to this. Regards On Saturday, April 4, 2020 at 7:10:57 PM UTC+3, Maurice Waka wrote: > > I'm trying to get some better looking form for my app. > I tried the method below to change the color and size of border among > others but it does not work. > > form=SQLFORM(db.posting)

Re: [web2py] Re: SQLFORM grid process not working

2020-03-06 Thread Andrew Rogers
> > Many thanks to you guys for answering so many user questions. I am finding >> it really helpful. >> > Cheers Andrew -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Rep

[web2py] Re: sqlform grid to show a field entirely, without cutting off the text

2019-06-18 Thread Vlad
works like a charm!! thank you Annet!!! thank you Anthony!!! On Tuesday, June 18, 2019 at 3:11:08 PM UTC-4, Annet wrote: > > I think Anthony answered this question in this post: > > https://groups.google.com/forum/?fromgroups=#!topic/web2py/okMVqyQPKV8 > > hope he did ;-) > > > Regards, > > Ann

[web2py] Re: sqlform grid to show a field entirely, without cutting off the text

2019-06-18 Thread 'Annet' via web2py-users
I think Anthony answered this question in this post: https://groups.google.com/forum/?fromgroups=#!topic/web2py/okMVqyQPKV8 hope he did ;-) Regards, Annet -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://cod

Re: [web2py] Re: sqlform grid search widget expression question

2019-06-05 Thread Eliezer (Vlad) Tseytkin
It's a reference field (foreign key) and the pull down has no empty value. It should have (because it can be null), but it doesn't for some reason. On Wed, Jun 5, 2019, 10:44 PM Dave S wrote: > > > On Wednesday, June 5, 2019 at 3:56:56 PM UTC-7, Vlad wrote: >> >> How can I search for None values

[web2py] Re: sqlform grid search widget expression question

2019-06-05 Thread Dave S
On Wednesday, June 5, 2019 at 3:56:56 PM UTC-7, Vlad wrote: > > How can I search for None values? > > For example, the search expression >table.customer == "1" > gives me records with customer equals 1. > I can't figure out how to search for records with customer field equals > None. > >

[web2py] Re: SQLFORM element(s) (delete or remove)

2018-10-12 Thread Anthony
http://web2py.com/books/default/chapter/29/05/the-views#Replacing-elements On Friday, October 12, 2018 at 12:53:39 AM UTC-4, lucas wrote: > > hello one and all, > > the API is tough to navigate. so, i'll ask. SQLFORM element and elements > is very powerful. along with update, insert, and appen

[web2py] Re: SQLFORM widget IS_IN_SET translation

2018-07-31 Thread rāma
Thank you! On Wednesday, 25 July 2018 19:58:48 UTC+8, Anthony wrote: > > You can specify labels associated with the values of an IS_IN_SET > validator in one of three ways: > > values = ['list', 'of', 'values'] > > # As a dictionary in {value: label, ...} form: > IS_IN_SET({value: T(value) for va

[web2py] Re: SQLFORM widget IS_IN_SET translation

2018-07-25 Thread Anthony
You can specify labels associated with the values of an IS_IN_SET validator in one of three ways: values = ['list', 'of', 'values'] # As a dictionary in {value: label, ...} form: IS_IN_SET({value: T(value) for value in values}) # As a list of tuples in (value, label) form: IS_IN_SET([(value, T(

[web2py] Re: SQLFORM dropdown and input field

2018-05-24 Thread Anthony
This might give you some ideas: http://www.web2pyslices.com/slice/show/1446/widget-select-or-add-option On Thursday, May 24, 2018 at 9:05:29 AM UTC-4, Yebach wrote: > > Hello > > I would like to create a field so the user can write in new text or > selects from drop down menu. > > What would be

[web2py] Re: SQLFORM widgets and drop-down filtering

2018-04-09 Thread Dave S
On Monday, April 9, 2018 at 7:17:42 AM UTC-7, Leonel Câmara wrote: > > I would just add some javascript to filter the state options when the year > changes. There's no widget specifically for this, you could make a custom > one, but it would always have to include javascript to do basically the

[web2py] Re: SQLFORM widgets and drop-down filtering

2018-04-09 Thread Leonel Câmara
I would just add some javascript to filter the state options when the year changes. There's no widget specifically for this, you could make a custom one, but it would always have to include javascript to do basically the same thing, so it's not worth it to make a custom widget if you will only

[web2py] Re: SQLFORM - update record, save datetime to table field

2018-02-02 Thread 黄祥
think you can use grid parameter onupdate, then assign the request.now as the value ref: http://web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM-grid best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web

[web2py] Re: SQLFORM IS_NOT_EMPTY validator dependent on the value of another request vara

2018-01-15 Thread Anthony
On Saturday, January 13, 2018 at 5:23:58 PM UTC-5, vtcpe12 wrote: > > Hi, > > I am utilizing the IS_IN_SET functionality to produce a select box in my > SQLFORM. One of the options is 'Other'. I have another simple text box that > I would like to force the user to enter a value for if Other is se

[web2py] Re: SQLForm not processing everytime values in form are changed

2017-10-16 Thread Mujeeb Farees
Yeah I figured that out. Made the following change and it worked. *Controller* # Days Form if session.days: days_form = SQLFORM(db.days,record=session.days,submit_button='Save',showid=False, _id='days_form') else: days_form = SQLFORM(db.days, submit_button

[web2py] Re: SQLForm not processing everytime values in form are changed

2017-10-11 Thread Anthony
> > # Days Form > if session.days: > days_form = > SQLFORM(db.days,record=session.days,submit_button='Save',showid=False, >_id='days_form') > else: > days_form = SQLFORM(db.days, submit_button = 'Save',_id='days_form') > if session.offer: > days

[web2py] Re: SQLFORM() as input to create query for SQLFORM.Grid

2017-03-20 Thread Anthony
query = ((db.paymenttype.id == request.vars.paymenttype) & (db.tariffrate.rate < request.vars.tariffrate) & [more conditions based on request.vars] & [condition

[web2py] Re: SQLFORM: how to show image thumbnail

2017-02-21 Thread Mirek Zvolský
I have found it, in book chapter 7. Here is the trick: form = SQLFORM(db.person, request.args(0), upload=URL('download')).process() On Monday, 20 February 2017 14:00:47 UTC+1, Najtsirk wrote: > > Hi, > > i have the following problem. > > *Model:* > db.define_table('person', > Field('name

[web2py] Re: SQLFORM: how to show image thumbnail

2017-02-21 Thread Mirek Zvolský
If you think just in the edition where you have an already saved image: CONTROLLER def person(): form = SQLFORM(db.person, request.args(0)).process() person = db.person(request.args(0)) return dict(form=form, person=person) VIEW {{=form.custom.begin}} {{=form.custom.widget.name}}

[web2py] Re: SQLFORM: how to show image thumbnail

2017-02-21 Thread Mirek Zvolský
Do you think - when adding new record, immediately after user will choose the file from disk? You can (using Javascript) catch the onchange event of the file imput and load the picture using window.FileReader into some element. Something like here: http://stackoverflow.com/questions/4459379/pre

[web2py] Re: SQLFORM doesn't work when browser cookies are disabled

2016-12-30 Thread Gaurav Vichare
Thanks Anthony, this is very helpful. In my case, to ignore users who disable cookies and only show message to enable cookies is best solution. Prevention to CSRF attack and Double submission is more important in my case. Thanks! On Friday, December 30, 2016 at 10:11:18 PM UTC+5:30, Anthony w

[web2py] Re: SQLFORM doesn't work when browser cookies are disabled

2016-12-30 Thread Anthony
On Friday, December 30, 2016 at 10:50:12 AM UTC-5, Gaurav Vichare wrote: > > Thanks Anthony for reply! I used session=None because SQLFORM was not > working on disabling browser cookies. > > Why can't you use cookies? > > Currently I am using session and cookies, but I am worried about the users

[web2py] Re: SQLFORM doesn't work when browser cookies are disabled

2016-12-30 Thread Gaurav Vichare
Thanks Anthony for reply! I used session=None because SQLFORM was not working on disabling browser cookies. Why can't you use cookies? Currently I am using session and cookies, but I am worried about the users who disable/block their browser cookies (don't know % of such users). I disabled m

[web2py] Re: SQLFORM doesn't work when browser cookies are disabled

2016-12-30 Thread Anthony
Note, to simply prevent a double submission via a page reload, after the initial submission, you can do a redirect to the same page (in that case, a double submission will only happen if the user hits the back button, but not upon a reload). If you want to prevent any double submission, you'll

[web2py] Re: SQLFORM doesn't work when browser cookies are disabled

2016-12-30 Thread Anthony
By default, forms include a hidden _formkey field, with the formkey also stored in the session. Upon submission, if the submitted formkey does not match one in the session, the submission is rejected -- this prevents CSRF attacks as well as double submission. If you set session=None, you disable

[web2py] Re: SQLFORM grid search : Get ids of filtered records

2016-12-14 Thread Anthony
See the answer at https://groups.google.com/d/msg/web2py/i01tO7LQVYE/APWn-NPoCAAJ. The only difference is you need to conditionally set the values to True or False depending on which button was clicked. Assuming the approve/reject filtered buttons are your 5th and 6th buttons, respectively, it

[web2py] Re: SQLFORM grid search : Get ids of filtered records

2016-12-13 Thread Madhavi
Hi, The code I am using is as below - I have 'Approve Selected Corporates', 'Reject Selected Corporates', 'Approve All Corporates' and 'Reject All Corporates' buttons working in the selectable list. I am changing corp_approved boolean column to True or False as per the button on which user cli

[web2py] Re: SQLFORM grid search : Get ids of filtered records

2016-11-14 Thread Anthony
On Monday, November 14, 2016 at 2:07:02 AM UTC-5, Anthony Smith wrote: > > Hi Anthony, > > I thought I would try this, but getting the following error: > (global name 'selected_true_callback' is not > defined) > It would be great if you could explain what I am doing wrong > You said you alread

[web2py] Re: SQLFORM grid search : Get ids of filtered records

2016-11-13 Thread Anthony Smith
Hi Anthony, I thought I would try this, but getting the following error: (global name 'selected_true_callback' is not defined) It would be great if you could explain what I am doing wrong thanks Anthony On Thursday, 27 October 2016 03:20:30 UTC+11, Anthony wrote: > > Note, the "searchable" ar

[web2py] Re: SQLFORM grid search : Get ids of filtered records

2016-10-26 Thread Anthony
Note, the "searchable" argument can be a custom callable -- so, you can create a custom function that first calls the default internal query builder to get the query that filters the records, then run the update using that query, and then simply return the query for use by the grid. Here is an

[web2py] Re: SQLFORM list:string auto-fill on update

2016-10-07 Thread Marlysson Silva
Try this.. http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?#callbacks-on-record-insert-delete-and-update Generating by python and append field list and after commit the transaction. Em sexta-feira, 7 de outubro de 2016 10:39:04 UTC-3, Pierre escreveu: > > Hi, > > I n

[web2py] Re: SQLFORM key error on simple table with one record

2016-10-01 Thread Peter
Never stop asking me to post anything Anthony! format='%(invoice_number)s - %(company)s - %(status)s - %(date)s') changed to format='%(invoice_number)s - %(company)s - %(status)s - %(issue_date)s') problem sorted! I must have looked at that table a dozen times and had, at least temporar

[web2py] Re: SQLFORM key error on simple table with one record

2016-10-01 Thread Peter
If there is anything stupid here Anthony, please remember I am a novice at this! db.define_table('invoice', Field( 'invoice_number' , 'integer' , writable=False), Field( 'company' , writable=False), Field( 'amount' , 'decimal(6,2)' , writable=False), Field( '

[web2py] Re: SQLFORM key error on simple table with one record

2016-10-01 Thread Anthony
Let's see the table definitions for db.invoice and db.task. Anthony On Friday, September 30, 2016 at 8:42:22 PM UTC-4, Peter wrote: > > > ...you should just remove the version of pydal you have in the >> dist-packages folder on your system. >> > >- renamed the system installed dal directory

[web2py] Re: SQLFORM key error on simple table with one record

2016-09-30 Thread Peter
> ...you should just remove the version of pydal you have in the > dist-packages folder on your system. That did it. - renamed the system installed dal directory - restored the table definition to the version originally causing Traceback - the form now opens without Traceback

[web2py] Re: SQLFORM key error on simple table with one record

2016-09-30 Thread Anthony
> I'm guessing thisis because the DAL development was "decoupled into a > separate code-base (PyDAL)" ? > I found the link to the git repository and downloaded the latest version > (I think), the CHANGES file refers to Version 16.09 > Looks like maybe you pip installed it, as it's in the di

[web2py] Re: SQLFORM key error on simple table with one record

2016-09-29 Thread Peter
On Friday, 30 September 2016 03:04:17 UTC+1, Anthony wrote: >> >> Yes, noticed that in the traceback -- that's why I asked -- assumed you >> were using that version intentionally (web2py defaults to the system >> installed pydal, as seen here >>

[web2py] Re: SQLFORM key error on simple table with one record

2016-09-29 Thread Peter
I created a duplicate table db.payment2 which gave the same error so I went through the fields one by one... This one change in the table definition avoids the Traceback and the form displays as expected! Field( 'invoice_ref' ), Applied the same change to the original and it now opens the

[web2py] Re: SQLFORM key error on simple table with one record

2016-09-29 Thread Anthony
Yes, noticed that in the traceback -- that's why I asked -- assumed you were using that version intentionally (web2py defaults to the system installed pydal, as seen here ). I think the current web2py is using an earlier versio

[web2py] Re: SQLFORM key error on simple table with one record

2016-09-29 Thread Peter
Just realised that the traceback shows web2py is using the system installed python pydal /usr/local/lib/python2.7/dist-packages/pydal all the files under this are dated May 17 -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Sour

[web2py] Re: SQLFORM key error on simple table with one record

2016-09-29 Thread Peter
Thanks Anthony, Not sure how to confirm that but what I can say, web2py is running on Linux and I found... - The file ~/web2py/gluon/packages/dal/CHANGESrefers to 'Version 16.03' The web2py site reports... - 2.14.6-stable+timestamp.2016.05.10.00.21.47 (Running on Rocket

[web2py] Re: SQLFORM key error on simple table with one record

2016-09-29 Thread Anthony
Is your version of pydal the one that goes with your version of web2py? On Thursday, September 29, 2016 at 12:05:14 PM UTC-4, Peter wrote: > > I'm punch drunk from looking at this one! > > Traceback > > 1. > 2. > 3. > 4. > 5. > 6. > 7. > 8. > 9. > 10. > 11. > 12. > 13. > 14. > 15. > 16. > 17. > 1

[web2py] Re: SQLFORM inside modal class from stupid.css

2016-07-27 Thread Massimo Di Pierro
Congratulations! Your code is a perfect web2py example. In fact it works well for me. Not sure why is does not work for me but something else is conflicting with it. I made an app that works based on your example: https://dl.dropboxusercontent.com/u/18065445/Tmp/web2py.app.stupid_modals.w2p I a

[web2py] Re: SQLFORM with variable as db.'variable'

2016-05-29 Thread Anthony
You can use the following syntax: db[mytable][myfield] However, you should think about whether you really want to create a new table for every user. Instead, maybe look into the multi-tenancy

[web2py] Re: SQLFORM with variable as db.'variable'

2016-05-29 Thread botasservice
Hello, any suggestions? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py

[web2py] Re: SQLFORM return javascript on accept

2016-04-28 Thread Anthony
If the form action itself is loaded in an iframe, then it won't work, as response.js is only executed at the end of Ajax requests. Is there any reason it needs to be loaded in an iframe rather than via a standard Ajax request? It might help if you show more of the relevant code. Anthony On Th

[web2py] Re: SQLFORM return javascript on accept

2016-04-28 Thread Mark Billion
Thats brilliant, but when I put it in the script in, it doesnt work: ajax_form = SQLFORM(db[field_array[3]], this_page_ajax, deletable=True) if ajax_form.process().accepted: response.js = 'alert("hi");' The form is being called thru a modal and ajax iframe, but even when

[web2py] Re: SQLFORM return javascript on accept

2016-04-27 Thread Leonel Câmara
Hey Mark, Use response.js for that If form.process().accepted: #dont reload response.js = """ $("#iframe_modal").remove(); $('.modal-dialog').remove(); """ -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Sourc

[web2py] Re: SQLFORM, custom, widget

2016-04-05 Thread 'DenesL' via web2py-users
Chapter 7: http://web2py.com/books/default/chapter/29/07/forms-and-validators in different sections: process http://web2py.com/books/default/chapter/29/07/forms-and-validators#The-process-and-validate-methods custom & widget http://web2py.com/books/default/chapter/29/07/forms-and-validators#Cust

[web2py] Re: SQLFORM buttons are misaligned

2016-02-10 Thread Massimo Di Pierro
Thank you! Fixed in trunk On Tuesday, 9 February 2016 14:25:52 UTC-6, SanDiego wrote: > > When used with buttons as follows, SQL form misses the offset causing the > buttons misplaced towards left (see buttons-misaligned.png file). > > buttons = [ > TAG.button(T('Save'),_type="submit"

[web2py] Re: SQLFORM changing the column of record

2016-01-29 Thread Dave S
On Friday, January 29, 2016 at 12:11:07 PM UTC-8, Anthony wrote: > > So just to clarify, the "record" argument to SQLFORM can either be the id > of the desired record, or it can be a Row object containing the record > (i.e., the result of querying the database to retrieve the record). > Ah, I

[web2py] Re: SQLFORM changing the column of record

2016-01-29 Thread Anthony
So just to clarify, the "record" argument to SQLFORM can either be the id of the desired record, or it can be a Row object containing the record (i.e., the result of querying the database to retrieve the record). record = db(db.test_table.field_1 == request.args(0)).select() > We want a Row obj

[web2py] Re: SQLFORM changing the column of record

2016-01-29 Thread Dave S
On Thursday, January 28, 2016 at 8:36:47 AM UTC-8, Lucas Schreiber wrote: > > Hi, > ist there a way to change the column of the record in an SQLFORM? > > For example, my code looks like this: > > module > dba.define_table('test_table', > Field('field_1', 'integer'), > Field('field_2', 'integer'))

Re: [web2py] Re: sqlform default field and redirect

2016-01-18 Thread Diego Tostes
thanks! works!! 2016-01-18 14:37 GMT-02:00 Anthony : > On Monday, January 18, 2016 at 11:22:16 AM UTC-5, Diego Tostes wrote: >> >> hi anthony! >> >> thnaks... the default field is working!! >> >> but the redirect i did no understand... >> > > Something like: > > callback = lambda *args: redire

Re: [web2py] Re: sqlform default field and redirect

2016-01-18 Thread Anthony
On Monday, January 18, 2016 at 11:22:16 AM UTC-5, Diego Tostes wrote: > > hi anthony! > > thnaks... the default field is working!! > > but the redirect i did no understand... > Something like: callback = lambda *args: redirect(URL('default', 'index')) form = SQLFORM.grid(..., oncreate=callback, o

Re: [web2py] Re: sqlform default field and redirect

2016-01-18 Thread Diego Tostes
hi anthony! thnaks... the default field is working!! but the redirect i did no understand... 2016-01-18 14:11 GMT-02:00 Anthony : > On Monday, January 18, 2016 at 9:29:29 AM UTC-5, Diego Tostes wrote: >> >> Hi, >> >> i have a sqlform like this: >> >> >> form = SQLFORM.grid(query=query_si

[web2py] Re: sqlform default field and redirect

2016-01-18 Thread Anthony
On Monday, January 18, 2016 at 9:29:29 AM UTC-5, Diego Tostes wrote: > > Hi, > > i have a sqlform like this: > > > form = SQLFORM.grid(query=query_simulados, user_signature=False, > fields=fields, > ignore_rw=True, orderby=default_sort_order, > c

[web2py] Re: SQLFORM grid returns a error : query object has no attribute _tablename

2016-01-08 Thread Anthony
Instead of {'db.Project': query}, it should be {'Project': query}. db.Project is a Table object, but "Project" is the table name. Anthony On Friday, January 8, 2016 at 2:12:17 PM UTC-5, Ron Chatterjee wrote: > > Responding to this old post. > > > query = db.Project.created_by == auth.user_id

[web2py] Re: SQLFORM grid returns a error : query object has no attribute _tablename

2016-01-08 Thread Ron Chatterjee
Responding to this old post. query = db.Project.created_by == auth.user_id; if_author = lambda row: (row.created_by==auth.user_id) #grid = SQLFORM.smartgrid(db.Project, constraints={'db.Project':query},editable=if_author,deletable=if_author,details=True,create=False,csv=False)

[web2py] Re: SQLFORM security question

2016-01-06 Thread Joe
Thanks very much Massimo, I appreciate your reply. On Tuesday, January 5, 2016 at 9:00:03 PM UTC+8, Massimo Di Pierro wrote: > > form = SQLFORM(db.table) prevents again CSRF but does not limit access. > For that you need to decorate the page with @auth.requires_login() etc. > > Once SQLFORM stor

[web2py] Re: SQLFORM security question

2016-01-05 Thread Massimo Di Pierro
form = SQLFORM(db.table) prevents again CSRF but does not limit access. For that you need to decorate the page with @auth.requires_login() etc. Once SQLFORM stores data in database it is in UTF8. If you extract data from database and you display it in a page in any way other than wrapping in X

[web2py] Re: SQLFORM security question

2016-01-04 Thread Joe
Thanks very much Anthony, I appreciate the detailed explanation. This is what my understanding was as well, but I wasn't 100% sure. In my case, the input was user contact info and some text submitted by the form and kept in the db records and not written back to a web page. But this brings up a

[web2py] Re: SQLFORM security question

2016-01-04 Thread Anthony
By default, SQLFORM protects against cross-site request forgery attacks (via a hidden _formkey field, with a matching formkey value in the session). And the DAL protects against SQL injection when making database inserts. However, at form submission/database-insert time, nothing prevents users

[web2py] Re: SQLFORM security question

2016-01-04 Thread Joe
I the db record text I had this: *sometext*+*www.mydomain.com *@ *sometext.com *http://*sometext*.com/?url=*www.mydomain.com *&id=e318 ..and more similar type of code. The input was long and it looked like a cross site scri

[web2py] Re: SQLFORM security question

2016-01-04 Thread Niphlod
it's the same code. A call to http://yoursite/yourapp/controller/function?url=something&id=somethingelse would not pass validation as SQLFORM is CSRF protected. If you are sure that that call got a record into the db, something is really wrong with your application as web2py doesn't allow it ou

[web2py] Re: SQLFORM security question

2016-01-04 Thread Joe
Thanks very much Niphlod, So, the special characters in the user input showing up in the table records text is basically harmless, right? That's what I though. Thanks for the correct code. I actually thought the code was: *form = SQLFORM(db.table).process() * *if form.accepted:* do somethin

[web2py] Re: SQLFORM security question

2016-01-04 Thread Niphlod
any SQLFORM is csrf protected so those kind of attempts resulted in nothing. the "correct code" is form = SQLFORM(db.table) if form.process().accepted: do something elif form.errors: error # this is probably where that call ended return dict(form=form) On Monday, January 4, 2016 at

Re: [web2py] Re: SQLform grid custom function for delete

2015-10-31 Thread Vid Ogris
Thank you so much. This works like a charm. 2015-11-01 14:24 GMT+08:00 Anthony : > I see the problem. When the grid involves a join, you must refer to fields > within a row via the row.table.field format. However, when you view/edit a > record from such a grid, only the record from a single table

Re: [web2py] Re: SQLform grid custom function for delete

2015-10-31 Thread Anthony
I see the problem. When the grid involves a join, you must refer to fields within a row via the row.table.field format. However, when you view/edit a record from such a grid, only the record from a single table is shown (i.e., there is no longer a join involved), so you must now refer to fields

Re: [web2py] Re: SQLform grid custom function for delete

2015-10-31 Thread Vid Ogris
I dont have special function for edit. When I click the icon on to edit the record I get this error. I did not wrote any special function. I am using web2py's 2015-11-01 11:38 GMT+08:00 Anthony : > On Friday, October 30, 2015 at 11:03:18 PM UTC-4, Yebach wrote: >> >> The thing is IF I put links =

Re: [web2py] Re: SQLform grid custom function for delete

2015-10-31 Thread Anthony
On Friday, October 30, 2015 at 11:03:18 PM UTC-4, Yebach wrote: > > The thing is IF I put links = [lambda row: A('',_class='glyphicon > glyphicon glyphicon-remove-sign', > callback=URL('settings','deactivate',vars=dict(table='workers_skills',field > = 'ws_status' > ,value = row.workers_skills.id

Re: [web2py] Re: SQLform grid custom function for delete

2015-10-30 Thread Vid Ogris
My whole function @auth.requires_login() def workers_skills(): user = auth.user_id org = db(db.auth_user.id == user).select(db.auth_user.organization)[0]["organization"] db.workers_skills.ws_organisation.default = org query=((db.workers_skills.ws_organisation == org) & (db.workers_skills.ws_statu

Re: [web2py] Re: SQLform grid custom function for delete

2015-10-30 Thread Vid Ogris
The thing is IF I put links = [lambda row: A('',_class='glyphicon glyphicon glyphicon-remove-sign', callback=URL('settings','deactivate',vars=dict(table='workers_skills',field = 'ws_status' ,value = row.workers_skills.id )))] Then my function for "deleting" record works but when I want to go to ed

Re: [web2py] Re: SQLform grid custom function for delete

2015-10-30 Thread Niphlod
is your "id" in the grid ? id it's not in the fields then it's not accessible On Friday, October 30, 2015 at 2:41:41 AM UTC+1, Yebach wrote: > > why am I getting an error AttributeError: 'Row' object has no attribute > 'id' > > when I try to set links = [lambda row: A('',_class='glyphicon

Re: [web2py] Re: SQLform grid custom function for delete

2015-10-29 Thread Vid Ogris
why am I getting an error AttributeError: 'Row' object has no attribute 'id' when I try to set links = [lambda row: A('',_class='glyphicon glyphicon glyphicon-remove-sign', callback=URL('settings','deactivate',vars=dict(table='workers_skills',field = 'ws_status' ,value = row.id )))], 2015-

[web2py] Re: sqlform process accepted, generate pdf base on sqlform data input and send email with the generated

2015-10-17 Thread 黄祥
learn from web2py book, it seems generate pdf function using reportlab must be landed on the page (the page must be visited so that it can be generated as expected, the pdf is generated but can't be opened). Already tried with onvalidation, redirect, modules, after_insert callback. the only thin

Re: [web2py] Re: SQLFORM grid process not working

2015-10-07 Thread Anthony
I suppose that's fine -- it just wasn't clear to where you were redirecting or why. On Wednesday, October 7, 2015 at 11:11:27 PM UTC-4, Yebach wrote: > > thanx for this > > Yes I have a redirect to another page. > > So if user creates a shift that already exists (code is based on times of > dura

Re: [web2py] Re: SQLFORM grid process not working

2015-10-07 Thread Vid Ogris
thanx for this Yes I have a redirect to another page. So if user creates a shift that already exists (code is based on times of duration), i want to give him a choice to go to that shift and activate it in case its status is archived do you recommend another way. I give now flash message but if

Re: [web2py] Re: SQLFORM grid process not working

2015-10-07 Thread Anthony
> > so far the link and everything works ok, but the first validators are not > working so i get an error cos the sh_.field which is autogenerate is not > done > > if (grid_shifts.create_form and grid_shifts.create_form.errors) or ( > grid_shifts.update_form and grid_shifts.update_form.errors):

Re: [web2py] Re: SQLFORM grid process not working

2015-10-06 Thread Yebach
> > Hello > > I have a new problem with my forms. > > I have validators on the fields > > But looks like they are not triggered, so for example > > When I insert a new record a first check should be done on the fields like > is_not_empty etc. > > Then if that is all ok it has to check the field s

Re: [web2py] Re: SQLFORM grid process not working

2015-10-06 Thread Yebach
Hello I have a new problem with my forms. I have validators on the fields But looks like they are not triggered, so for example When I insert a new record a first check should be done on the fields like is_not_empty etc. Then if that is all ok it has to check the field sh_code and if this cod

  1   2   3   4   5   6   >