[web2py] Re: SQLFORM.factory in 2.17.1

2018-10-04 Thread Leonel Câmara
Yes this is a web2py bug as it's a backwards incompatibility. I've fixed it here: https://github.com/web2py/web2py/pull/2030 You can either apply my fix or revert to the previous web2py version until the next version is out. -- Resources: - http://web2py.com - http://web2py.com/book (Document

[web2py] Re: SQLFORM.factory edit existing record(s) in multiple tables

2017-02-24 Thread lucas
I figured, but wasn't sure. I'm doing it the old fashioned way. thanx Massimo. -- 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 messag

[web2py] Re: SQLFORM.factory edit existing record(s) in multiple tables

2017-02-24 Thread Massimo Di Pierro
Sorry SQLFORM.factory does not provide this functionality. On Thursday, 23 February 2017 12:44:15 UTC-6, lucas wrote: > > hello one and all, > > ok, so I have the basic code: > > btn = [INPUT(_type='submit', _name='submit', _value='Add 1-Step')] > btn.append(INPUT(_type='submit', _name='su

[web2py] Re: SQLFORM.FACTORY editing a document. Save reports no upload files

2016-12-08 Thread Kenwyn Pilgrim
Massimo Thank you. On Friday, December 2, 2016 at 5:18:51 PM UTC-5, Massimo Di Pierro wrote: > > 1. I do not now. that is outside of web2py control. it is controlled by > the browser > 2. you can just use > > form = SQLFORM.factory(Field('myfile','upload')).process() > > and then if form.accepte

[web2py] Re: SQLFORM.FACTORY editing a document. Save reports no upload files

2016-12-02 Thread Massimo Di Pierro
1. I do not now. that is outside of web2py control. it is controlled by the browser 2. you can just use form = SQLFORM.factory(Field('myfile','upload')).process() and then if form.accepted: request.vars.myfile.file.seek(0) data = request.vars.myfile.file.read() On Thursday, 1 December 2016

[web2py] Re: SQLFORM.FACTORY editing a document. Save reports no upload files

2016-12-01 Thread Kenwyn Pilgrim
Massimo Thanks. This works. Just 2 follow-up questions. 1. Why does the *Choose File* button continue to say *No file chosen*? (The form submits though, with no validation errors) 2. Can this be done with *SQLFORM.factory *instead of *SQLFORM*? Meaning that when I set the defau

[web2py] Re: SQLFORM.FACTORY editing a document. Save reports no upload files

2016-11-25 Thread Massimo Di Pierro
You are you doing this: if edit_mode: id = int(request.args[0]) q = db.upload_file.id == id rows = db(q).select() for row in rows: for field in row: if field in db.upload_file.fields: db.upload_file[field].default = row[field] ... fo

[web2py] Re: SQLFORM.FACTORY editing a document. Save reports no upload files

2016-11-21 Thread Kenwyn Pilgrim
I too have this issue with using SQLFORM.factory to edit. My model looks like: db.define_table('upload_file', Field('doc_type', 'reference document_type', required=True, label=T('Type')), Field('pdf_name', 'upload', label=T('PDF Document'),

[web2py] Re: SQLForm.factory Pre-Submit Processing Using JavaScript

2016-04-26 Thread Eliot Simcoe
In case anyone else ever has this problem, I will post my own solution. Web2Py traps all form submissions in web2py.js. To override this behaviour we need to add the "no_trap" class to the form declaration: single_payment_form = SQLFORM.factory( Field('tenant_name','string',label

[web2py] Re: SQLFORM.factory upload field can't show link

2016-03-01 Thread killzane
It's work! Thanks! Anthony於 2016年3月1日星期二 UTC+8上午2時24分48秒寫道: > > The default value should be the file name, but you don't have to set it > when you define the table in the model. Instead, set the default in the > controller right *before* you create the form: > > db.project.project_pdf.default =

[web2py] Re: SQLFORM.factory upload field can't show link

2016-02-29 Thread Anthony
The default value should be the file name, but you don't have to set it when you define the table in the model. Instead, set the default in the controller right *before* you create the form: db.project.project_pdf.default = the_file_name Simply setting form.vars.project_pdf will not work. Anth

[web2py] Re: SQLFORM.factory upload field can't show link

2016-02-28 Thread killzane
So if I have this field in db.project Field('project_pdf', 'upload', label='Project PDF', comment='', uploadfolder ='app/uploads'), I must change to Field('project_pdf', 'upload', label='Project PDF', comment='', uploadfolder ='app/uploads', default=''), what content should I put in "default" att

[web2py] Re: SQLFORM.factory upload field can't show link

2016-02-28 Thread Anthony
The widget gets created when the form is initialized, so if you want to specify a value for the file URL, you should do it by setting the "default" attribute of the upload field in the db.project table *before* creating the table. Anthony On Sunday, February 28, 2016 at 10:07:28 AM UTC-5, kill

[web2py] Re: SQLFORM.factory upload field can't show link

2016-02-28 Thread killzane
I want to modify a record from db.project, and there are a reference field in db.project. So I use SQLFORM.factory to add field to put reference list name. the code I paste is simplify version here is full code form = SQLFORM.factory(Field('list_name', 'string', label='List Name'), db. project, d

[web2py] Re: SQLFORM.factory upload field can't show link

2016-02-28 Thread Anthony
Sorry, still not clear what you are trying to do, and you have not explained why you are iterating over the Fields of the db.project table. On Sunday, February 28, 2016 at 3:48:26 AM UTC-5, killzane wrote: > > Because I want to add other field to the form so I use SQLFORM.factory. > > And this is

[web2py] Re: SQLFORM.factory upload field can't show link

2016-02-28 Thread killzane
Because I want to add other field to the form so I use SQLFORM.factory. And this is my __copydata method def __copydata(src, dest, fields): if src: for k in fields: if src.has_key(k): dest[k] = src[k] return dict() Anthony於 2016年2月26日星期五 UTC+8下午9時08分1

[web2py] Re: SQLFORM.factory upload field can't show link

2016-02-26 Thread Anthony
> for t in db.project: > query = (t.id == request.vars.id) > __copydata(db(query).select(limitby=(0,1)).first(), form.vars, > t.fields) > The above is confusing and cannot be the actual code, as it would raise an exception. When you iterate over db.project, you get its Field objects (

[web2py] Re: SQLFORM.factory upload field can't show link

2016-02-25 Thread killzane
This is the code in my controller form = SQLFORM.factory(Field('list_name', 'string', label='List Name'), db. project, table_name='project',upload=URL('download')) for t in db.project: query = (t.id == request.vars.id) __copydata(db(query).select(limitby=(0,1)).first(), form.vars, t.field

[web2py] Re: SQLFORM.factory upload field can't show link

2016-02-25 Thread Anthony
Can you show the code you are using to edit an existing record via SQLFORM.factory? On Thursday, February 25, 2016 at 10:50:12 AM UTC-5, killzane wrote: > > Yes, I mean when I want to edit an existing record, there are no link. > But I can find the file when use appadmin. > > Anthony於 2016年2月25日

[web2py] Re: SQLFORM.factory upload field can't show link

2016-02-25 Thread killzane
Yes, I mean when I want to edit an existing record, there are no link. But I can find the file when use appadmin. Anthony於 2016年2月25日星期四 UTC+8下午10時41分32秒寫道: > > There should only be a file link if you are editing an existing record > (with an existing file). If you are displaying a "create" form

[web2py] Re: SQLFORM.factory upload field can't show link

2016-02-25 Thread Anthony
There should only be a file link if you are editing an existing record (with an existing file). If you are displaying a "create" form, to what file would you expect such a link to point? Anthony On Thursday, February 25, 2016 at 4:19:10 AM UTC-5, killzane wrote: > > This is my code > form = SQL

[web2py] Re: SQLFORM.factory - form.process().accepted fails first time but works after that

2016-02-17 Thread Anthony
Note, ajax_trap is irrelevant if ajax=True (it just indicates forms should be trapped within non-ajax components). Anthony On Wednesday, February 17, 2016 at 4:35:43 PM UTC-5, Jim S wrote: > > I have them both set to True. > > Anthony - no time yet to package up a sample... Will see if I can

[web2py] Re: SQLFORM.factory - form.process().accepted fails first time but works after that

2016-02-17 Thread Jim S
I have them both set to True. Anthony - no time yet to package up a sample... Will see if I can find time tomorrow. -Jim On Wednesday, February 17, 2016 at 3:00:39 PM UTC-6, Val K wrote: > > It seems after first click your form is reloaded, may be there is nested > forms in your html-page o

[web2py] Re: SQLFORM.factory - form.process().accepted fails first time but works after that

2016-02-17 Thread Val K
It seems after first click your form is reloaded, may be there is nested forms in your html-page or something else. What does your LOAD-call like? try ajax=true or ajax_trap=true On Wednesday, February 17, 2016 at 12:17:04 AM UTC+3, Jim S wrote: > > I have a simple SQLFORM.factory form. > >

[web2py] Re: SQLFORM.factory - form.process().accepted fails first time but works after that

2016-02-16 Thread Anthony
Can you attach a minimal app that reproduces the problem? On Tuesday, February 16, 2016 at 4:17:04 PM UTC-5, Jim S wrote: > > I have a simple SQLFORM.factory form. > > Sometimes when I click on the submit button the > form.process(keepvalues=True).accepted returns False - clicking on enter > imm

Re: [web2py] Re: SQLFORM.factory() - Display name instead of integer for user_id?

2016-01-18 Thread Richard Vézina
You are welcome :) Richard On Mon, Jan 18, 2016 at 4:11 PM, Ron Chatterjee wrote: > Awesome. Thank you! > > On Monday, January 18, 2016 at 3:20:35 PM UTC-5, Richard wrote: >> >> If I understand it properly you need : >> >> IS_EMPTY_OR(IS_IN_DB(...)) >> >> Richard >> >> On Mon, Jan 18, 2016 at 3

Re: [web2py] Re: SQLFORM.factory() - Display name instead of integer for user_id?

2016-01-18 Thread Ron Chatterjee
Awesome. Thank you! On Monday, January 18, 2016 at 3:20:35 PM UTC-5, Richard wrote: > > If I understand it properly you need : > > IS_EMPTY_OR(IS_IN_DB(...)) > > Richard > > On Mon, Jan 18, 2016 at 3:17 PM, Ron Chatterjee > wrote: > >> I have a different problem with similar table/field. I have a

Re: [web2py] Re: SQLFORM.factory() - Display name instead of integer for user_id?

2016-01-18 Thread Richard Vézina
If I understand it properly you need : IS_EMPTY_OR(IS_IN_DB(...)) Richard On Mon, Jan 18, 2016 at 3:17 PM, Ron Chatterjee wrote: > I have a different problem with similar table/field. I have a reference to > auth_user. But I want the table to work even it doesn't assign any user. > But if I do

Re: [web2py] Re: SQLFORM.factory() - Display name instead of integer for user_id?

2016-01-18 Thread Ron Chatterjee
I have a different problem with similar table/field. I have a reference to auth_user. But I want the table to work even it doesn't assign any user. But if I don't pick any auth_user from the drop down menu (assign to) I get an error (attached), value not in a database. And I get the error even

Re: [web2py] Re: SQLFORM.factory() - Display name instead of integer for user_id?

2016-01-18 Thread Richard Vézina
You should use field .clone() method instead of redefining fields... For represent the user_id by it username, you should specify the represent field like this in your IS_IN_DB() validator : IS_IN_DB(db,db.auth_user.id, '%(username)s') Richard On Wed, Jan 13, 2016 at 7:36 PM, Tom Campbell wrot

[web2py] Re: SQLFORM.factory with exception: user is tampering with form's record_id: != None

2016-01-15 Thread Silvan Marco Fin
Hi! Am Donnerstag, 14. Januar 2016 21:04:25 UTC+1 schrieb Anthony: > > Looks like the way you were using it before wasn't supposed to work but > did due to a bug. The purpose of the "record" argument is to enable a > database record to be updated, and so it is expected that the record will > ha

[web2py] Re: SQLFORM.factory with exception: user is tampering with form's record_id: != None

2016-01-14 Thread Anthony
Looks like the way you were using it before wasn't supposed to work but did due to a bug. The purpose of the "record" argument is to enable a database record to be updated, and so it is expected that the record will have an "id" field (or a set of fields serving as a primary key). It appears you

[web2py] Re: SQLFORM.factory() - Display name instead of integer for user_id?

2016-01-13 Thread Tom Campbell
On Wednesday, January 13, 2016 at 3:38:56 PM UTC-8, Tom Campbell wrote: > > Creating a custom form that relates first name and last name fields to the > db.auth_user's user_id field. In the form below the user ID shows as an > integer in the dropdown but I'd like it to show as the user's name.

[web2py] Re: SQLFORM.factory() - Display name instead of integer for user_id?

2016-01-13 Thread 黄祥
i think you can use format or represent to achieve it. e.g. *somewhere in models after you define auth tables* custom_auth_table = db[auth.settings.table_user_name] custom_auth_table._format = '%(first_name)s %(last_name)s' *controllers that have SQLFORM.factory that refer to auth_user table* req

[web2py] Re: sqlform.factory

2015-09-25 Thread Laurent Lc
Sorry i found distinct=True Le vendredi 25 septembre 2015 16:25:42 UTC+2, Laurent Lc a écrit : > > Hi, > > i'd like to create a form from a database. > form = SQLFORM.factory( > Field('groupe',requires=IS_IN_DB(db1,db1.test.id > ,'%(groupe)s',multiple=False)), > Field('finance

[web2py] Re: SQLFORM.factory writable=False

2015-05-04 Thread Anthony
You haven't defined a "represent" attribute for the field, so when you set the field to read-only, it just displays the actual value, which is the integer ID. This doesn't happen when the field is writable because the IS_IN_DB validator generates a select widget that shows the "name" values. Tr

[web2py] Re: SQLFORM.factory writable=False

2015-05-04 Thread 黄祥
perhaps you can try: e.g. #write_in_form = 'edit' in request.args write_in_form = '1' in request.vars form_fields.append(Field('AllocationScenario', writable = not write_in_form, default=allocation_version.id, requires=IS_I

[web2py] Re: SQLFORM.factory adding dynamic form

2015-03-25 Thread Paolo Valleri
To fix the exception 'table already defined' use define_table() with redefine=True see http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=redefine#redefine Paolo On Wednesday, March 25, 2015 at 2:17:45 AM UTC+1, Ramkrishan Bhatt wrote: > > I am looking from

[web2py] Re: SQLFORM.factory adding dynamic form

2015-03-24 Thread Ramkrishan Bhatt
I am looking from templating genrated form through SQLFORM.factory is possible that we can clone of address table Multiple time like one person can have multiple address using add address button. Than submit all together with bulk insert. -- Resources: - http://web2py.com - http://web2py.com/b

[web2py] Re: SQLFORM.factory adding dynamic form

2015-03-23 Thread Val K
I think, there is no problem, but I am not sure that I understand what you want: - do you want to edit/insert multiple records of/to the same table (person-address-relation for example) at once, per single form's accept? - do you want to edit/insert single records of/to few tables at once? or d

[web2py] Re: SQLFORM.factory and inserting records...

2015-03-20 Thread pumplerod
Thank you. So is there a way to run a post process after SQLFORM.factory or do I simply keep the code within the original function because this seems to work... def brand(): if request.args(0) == 'register': form = SQLFORM.factory(db.auth_user,db.brands, fields=['brand_name', 'br

[web2py] Re: SQLFORM.factory and inserting records...

2015-03-20 Thread Niphlod
There are a few errors in the code, and in the assumptions you are doing: - SQLFORM.factory doesn't do any db I/O, so process() doesn't actually store anything - either you use form.process().accepted or form.accepts(request, session) - you're hacking auth.forms, which is undocumented and unpredi

[web2py] Re: SQLFORM.factory - RuntimeError: you must specify a Field(...,uploadfolder=...)

2015-03-16 Thread Alex Glaros
still doesn't work but this prevents error message: 1. insert in db.py 'import os' (without quotes) anywhere, but before my extrafield definition with uploadfolder=os.path.join.. 2. adding this to table definition: Field('thumbnail', 'upload', uploadfolder=os.path.join(request.folder,'uplo

[web2py] Re: SQLFORM.factory - RuntimeError: you must specify a Field(...,uploadfolder=...)

2015-03-15 Thread Alex Glaros
I have this problem with version 2.9.12 works with form but not factory. tried workaround but can't get syntax right. Workaround error is does not know global "os" Can someone please post workaround syntax for me? Here is my factory code: form=SQLFORM(db.SuperObject,db.Party,db.auth_user

[web2py] Re: SQLFORM.factory adding dynamic form

2015-03-06 Thread Ramkrishan Bhatt
No Solution for one to many composite form ? -- 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 G

[web2py] Re: SQLFORM.factory adding dynamic form

2015-03-05 Thread Ramkrishan Bhatt
table already defined: address Anyway i guess you are not understanding requirement :- SQLFORM.factory(table1,table2,table3) if form.process().accepted: do something. Now we want like we can add extra add table2 form in dynamically. like in view composit form of table1 table2 (op

[web2py] Re: SQLFORM.factory adding dynamic form

2015-03-04 Thread 黄祥
perhaps you can create an address table and use list:reference in sqlform.factory e.g. (not tested) db.define_table('address', Field('address') ) def form_from_factory(): form = SQLFORM.factory( Field('address', *'list:reference', requires = IS_IN_DB(db, db.address.id, '%(address)s'

Re: [web2py] Re: SQLFORM.factory with upload field - the operation is insecure

2014-12-23 Thread Cynthia Butler
Thank you, very helpful info to me. On Sunday, December 21, 2014 7:25:46 PM UTC-7, Jim S wrote: > > Yes. The issue was that I had it in a loaded component. That is not > supported and doesn't work. And, I know better, I've ran into this > before and just forgot about that restriction this t

Re: [web2py] Re: SQLFORM.factory with upload field - the operation is insecure

2014-12-21 Thread Jim Steil
Yes. The issue was that I had it in a loaded component. That is not supported and doesn't work. And, I know better, I've ran into this before and just forgot about that restriction this time. Jim On Dec 21, 2014 12:18 PM, "Cynthia Butler" wrote: > Did you find an answer to this? Just curio

[web2py] Re: SQLFORM.factory with upload field - the operation is insecure

2014-12-21 Thread Cynthia Butler
Did you find an answer to this? Just curious. Thanks. On Monday, December 15, 2014 8:42:00 AM UTC-7, Jim S wrote: > > I've got an issue that is really puzzling me. > > I have a form, SQLFORM.factory with one field, an upload field. > > When I click on submit to submit the form (adding a new record

[web2py] Re: SQLFORM.factory --> select multiple=False doesn't work

2014-10-30 Thread Niphlod
> > Why I need a combobox with multiple=False?, Well, is for aesthetics. > > although misleading. "select one choice amongst multiple items" is usually: - a select box --> when items are a lot - radio buttons --> when items are a few -- Resources: - http://web2py.com - http://web2py.com/book (

[web2py] Re: SQLFORM.factory --> select multiple=False doesn't work

2014-10-30 Thread José Eloy
(SOLVED) Anthony: Thanks for your ideas. Finally I solved this: Code: 1. form = SQLFORM.factory( 2.Field('numero', requires=IS_NOT_EMPTY()), 3.Field('fecha', 'datetime', requires=IS_NOT_EMPTY()), 4.Field('gasto', requires= IS_IN_SET(gastos_list,

[web2py] Re: SQLFORM.factory --> select multiple=False doesn't work

2014-10-30 Thread Anthony
On Thursday, October 30, 2014 3:34:02 PM UTC-4, José Eloy wrote: > > Anthony > > With options I mean SQLFORM.widgets.options.widget. I checked and > discovered that using either SQLFORM.widgets.options.widget or > SQLFORM.widgets.multiple.widget I get an html select element. My question > is how

[web2py] Re: SQLFORM.factory --> select multiple=False doesn't work

2014-10-30 Thread José Eloy
Anthony With options I mean SQLFORM.widgets.options.widget. I checked and discovered that using either SQLFORM.widgets.options.widget or SQLFORM.widgets.multiple.widget I get an html select element. My question is how to create a SELECT (no dropdown) with multiple=False. I want to select only

[web2py] Re: SQLFORM.factory --> select multiple=False doesn't work

2014-10-30 Thread Anthony
On Thursday, October 30, 2014 3:08:13 PM UTC-4, José Eloy wrote: > > Thanks Anthony > > But if I use options I get a dropdown combo, instead I want a SELECT. Is > this possible? > Not sure what you mean. With "options", you should get a dropdown that allows you to select a single option. Both "o

[web2py] Re: SQLFORM.factory --> select multiple=False doesn't work

2014-10-30 Thread José Eloy
Thanks Anthony But if I use options I get a dropdown combo, instead I want a SELECT. Is this possible? Regards -- 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 Issue

[web2py] Re: SQLFORM.factory --> select multiple=False doesn't work

2014-10-30 Thread Anthony
You have explicitly specified the "multiple" widget for this field, so the validator has no effect on the widget. You should instead use the "options" widget. Anthony On Thursday, October 30, 2014 2:41:04 PM UTC-4, José Eloy wrote: > > Hi! > > I have a SQLFORM.factory that define a SELECT. I wa

[web2py] Re: SQLFORM.factory deletable field

2014-10-07 Thread José Eloy
Thanks Leonel. That's is working well. Regards El martes, 7 de octubre de 2014 16:50:27 UTC-5, José Eloy escribió: > > Hello! > > Is it possible to implement a SQLFORM.factory deletable field? I can't to > use the normal SQLFORM because I'm using keyed tables. > > The SQLFORM.factory I'm using

[web2py] Re: SQLFORM.factory deletable field

2014-10-07 Thread Leonel Câmara
You could add this to the factory Field('eliminar', 'boolean', default=False), -- 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 b

[web2py] Re: SQLFORM.factory fails to save to database, id is null

2014-09-24 Thread Anthony
As the book shows, you should use: db.table.insert(**db.table._filter_fields(form.vars)) Anthony On Tuesday, September 23, 2014 5:10:48 AM UTC-4, Andy Joel wrote: > > I have a very simple form processing page in my controller: > > def new(): > form = SQLFORM.factory( > Field('f_name'

[web2py] Re: SQLFORM.factory - other types of field

2014-05-20 Thread Fabiano Almeida
Understood. Thank you!!! Fabiano. Em terça-feira, 20 de maio de 2014 20h49min05s UTC-3, 黄祥 escreveu: > > please read dal chapter about field constructor. > taken from the book about SQLFORM.factory : > The Field object in the SQLFORM.factory() constructor is fully documented > in the DAL > chap

[web2py] Re: SQLFORM.factory - other types of field

2014-05-20 Thread 黄祥
please read dal chapter about field constructor. taken from the book about SQLFORM.factory : The Field object in the SQLFORM.factory() constructor is fully documented in the DAL chapter. best regards, stifan -- Resourc

[web2py] Re: SQLFORM.factory and jQueryUI effects

2014-04-24 Thread Greg Vaughan
Ahhh I see... thanks once again On Tuesday, 22 April 2014 19:17:08 UTC+10, Niphlod wrote: > > SQLFORM.factory creates a form based on what fields you pass to it. If you > pass tables, fields are extracted from the table definitions. However, it's > still "managed" as if it was a single table con

[web2py] Re: SQLFORM.factory pre populating from tables

2014-04-22 Thread Anthony
Yes, the easiest way is generally to set the default value of the field prior to creating the form. On Tuesday, April 22, 2014 7:26:19 PM UTC-4, libe...@gmail.com wrote: > > Hi everyone, > > I am trying to make a form that mainly gets its data from a single table, > there are however > > some f

[web2py] Re: SQLFORM.factory and jQueryUI effects

2014-04-22 Thread Niphlod
SQLFORM.factory creates a form based on what fields you pass to it. If you pass tables, fields are extracted from the table definitions. However, it's still "managed" as if it was a single table containing all the fields from all the tables you pass, so there's only one table_name available. Of

[web2py] Re: SQLFORM.factory and jQueryUI effects

2014-04-21 Thread Greg Vaughan
Hey Niphlod, Thanks for that answer... you are spot on in seeing the problem... my "#appointments_blah" id's did get changed to "#no_table_blah" hence the jQuery was targeting id's that no longer existed... To "fix" it I simply changed the hard coded script at this point to target "#no_table_

[web2py] Re: SQLFORM.factory and jQueryUI effects

2014-04-21 Thread Niphlod
check the resulting html markup for sqlform.factory. As it's intended originally to work with Fields that don't belong to a table, the "table" part prefix to every field is "no_table". So, your "#appointments_unit" that is probably related to a table appointments and a field unit with SQLFORM,

Re: [web2py] Re: SQLFORM.factory without a database table

2014-02-18 Thread Marty McCasland
Was aiming to create a grid. Just used an in-memory SQLite db to achieve the grid. Works great. Sent from my iPad > On Feb 18, 2014, at 3:14 PM, Richard Vézina > wrote: > > Don't understand your question... It generate a self validating form base on > field validator defined in models if

Re: [web2py] Re: SQLFORM.factory without a database table

2014-02-18 Thread Richard Vézina
Don't understand your question... It generate a self validating form base on field validator defined in models if you clone you field from there or the Field() if you create field input on the fly... Do you want a form? or a Grid? If the latter there the TABLE() helper... Richard On Tue, Feb

[web2py] Re: SQLFORM.factory without a database table

2014-02-18 Thread Dave S
On Thursday, February 13, 2014 9:03:33 PM UTC-8, A36_Marty wrote: > > I would like to make a grid-like screen without an underlying database > table. > > is this something interactive, where the user is entering data? Or is it just a display? If the latter, perhaps you just want the TABLE hel

Re: [web2py] Re: SQLFORM.factory without a database table

2014-02-14 Thread Richard Vézina
To insert/update record with .factory() you can do something like that : if form.process().accepted: if condition when update mode is not meat: id = db.underlying_table.insert(field1=form.vars.field1, ...) # You keep the id in cas you need it to insert some information in another tabl

[web2py] Re: SQLFORM.factory without a database table

2014-02-14 Thread Anthony
SQLFORM.factory is for generating forms, not grids. The grid requires an actual database, though you can use a SQLite memory database: https://groups.google.com/d/msg/web2py/g4Mon6PvNFc/jytHfEnOXTIJ. Anthony On Friday, February 14, 2014 12:03:33 AM UTC-5, A36_Marty wrote: > > I would like to ma

[web2py] Re: SQLFORM.factory defaults?

2013-12-29 Thread Anthony
You can do: form = SQLFORM.factory( Field('name', 'string'), ...) form.vars.name = 'John' form.process() Note, you have to set form.vars before calling form.process(). Anthony On Sunday, December 29, 2013 5:00:16 AM UTC-5, User wrote: > > I'm creating a form that is not based on a datab

[web2py] Re: SQLFORM.factory defaults?

2013-12-29 Thread Massimo Di Pierro
It is possible. On Sunday, 29 December 2013 04:00:16 UTC-6, User wrote: > > I'm creating a form that is not based on a database table. I understand I > can add a default to a field created with SQLFORM.factory, for example: > > form = SQLFORM.factory( > Field('name', 'string', defaul

[web2py] Re: SQLFORM.factory

2013-10-06 Thread Kees de Blois
Thanks, Niphlod, that did the trick! On Sunday, October 6, 2013 6:14:22 PM UTC+2, Niphlod wrote: > > whoa, what I meant was passing a variable to a function, not an action > (action being a function that generates a page). > the onvalidation call works only for functions, not actions. > in

[web2py] Re: SQLFORM.factory

2013-10-06 Thread Niphlod
whoa, what I meant was passing a variable to a function, not an action (action being a function that generates a page). the onvalidation call works only for functions, not actions. in that case, why don't you simply use redirect() from one action to another ? On Sunday, October 6, 2013 5:46:

[web2py] Re: SQLFORM.factory

2013-10-06 Thread Kees de Blois
Thanks Niphlod for putting me on the right track. How do I load the session.thema variable in the target function (in the place of request.args(0)) @auth.requires_login() def tekstperthema(): response.flash = "Tekstregister items per thema view!" form = SQLFORM.factory(Field('thema',re

[web2py] Re: SQLFORM.factory

2013-10-06 Thread Niphlod
I'd use onvalidation http://web2py.com/books/default/chapter/29/07/forms-and-validators#onvalidation On Sunday, October 6, 2013 1:05:44 PM UTC+2, Kees de Blois wrote: > > How do I send the variable of the drop down list to another function? > > def tekstperthema(): > response.flash = "Tekstre

[web2py] Re: SQLFORM.factory requires explicit uploadfolder

2013-09-05 Thread Massimo Di Pierro
You can always define def UploadField(*a,**b): b['uploadfolder'] = request.folder return Field(*a,**b) db.define_table( UploadField(...)) I often define def HiddenField(*a,**b): b['readable'] = b['writable'] = False return Field(*a,**b) def ReadonlyField(*a,**b):

[web2py] Re: SQLFORM.factory requires explicit uploadfolder

2013-09-05 Thread Alan Etkin
> > We could use current.request.folder but we would have to couple the dal > code to current. that is something we avoided to far. > I don't think it is necessary to use current in dal just for this. I don't mind adding uploadfolder on each Field(...) call, I just was curious why it was neede

[web2py] Re: SQLFORM.factory requires explicit uploadfolder

2013-09-05 Thread Massimo Di Pierro
We could use current.request.folder but we would have to couple the dal code to current. that is something we avoided to far. On Thursday, 5 September 2013 11:31:36 UTC-5, Alan Etkin wrote: > > > In that case, how will you determine the absolute folder path? > > It seems there's no way, unless th

[web2py] Re: SQLFORM.factory field's type and default properties are not working as expected

2013-09-05 Thread Niphlod
On Thursday, September 5, 2013 11:04:53 AM UTC+2, Gliese 581 g wrote: > > Hi, > > I have a cutom form which I am displaying using SQLFORM.factory as given > below: > > searchform=SQLFORM.factory( > Field('uid', 'integer', requires=[IS_LENGTH(15,15)]), > Field('uaccount','unic

[web2py] Re: SQLFORM.factory requires explicit uploadfolder

2013-09-05 Thread Alan Etkin
> In that case, how will you determine the absolute folder path? It seems there's no way, unless the field class reads request.folder which will be not always available. -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from

[web2py] Re: SQLFORM.factory requires explicit uploadfolder

2013-09-04 Thread Anthony
I guess the Field class doesn't have knowledge of the filesystem. When Field() is used inside of define_table(), it figures out the folder location from db._adapter.folder, but there is no db._adapter when using Field() within SQLFORM.factory(). In that case, how will you determine the absolute

[web2py] Re: SQLFORM.factory requires explicit uploadfolder

2013-09-04 Thread Massimo Di Pierro
No objection. On Wednesday, 4 September 2013 16:27:35 UTC-5, Alan Etkin wrote: > > Is this bug or feature? > > def myaction(): > form = SQLFORM.factory(Field("myupload", "upload")) > if form.process().accepted: > print form.vars > return dict(form=form) > > On submission it pro

[web2py] Re: SQLFORM.factory and keepvalues ... the arg doesn't work for me.

2013-07-26 Thread Massimo Di Pierro
Yes. keepvalue is an argument of process(...) not of factory(...). On Thursday, 25 July 2013 19:16:05 UTC-5, Tim Richardson wrote: > > I noticed that SQLFORM.factory with argument keepvalues=True doesn't work, > but > if form.process(keepvalues=True).accepted: > > works fine. > > This is with tru

[web2py] Re: sqlform.factory multiple requires problem

2013-07-24 Thread André Kablu
If you use IS_IN_DB it will automatically check if is not empty. The function IS_IN_DB, if used inside list brackets [IS_IN_DB(...,...)] will not show the dropdown. This is the correct behavior. Em quarta-feira, 24 de julho de 2013 20h19min18s UTC-3, Antonis Konstantinos Tzorvas escreveu: > >

[web2py] Re: sqlform.factory widget in field problem

2013-06-28 Thread António Ramos
Once again, thank you No dia Sexta-feira, 28 de Junho de 2013, Tom Russelltom@caregointl.comescreveu: > Actually probably just comment out the line: > > fs3=form[0][-1] # submit row (last) > > and that I think will put the submit outside the fieldset. > > > On Fri, Jun 28, 2013 at 2:50 AM, An

[web2py] Re: SQLFORM.factory and list:integer error

2013-06-20 Thread Niphlod
you upgraded, but the patch isn't there. as you may notice, the exception raises at the exact same line as before. I just sent an email to Massimo to let him know that ATM the fix isn't in trunk http://code.google.com/p/web2py/issues/detail?id=1547 On Thursday, June 20, 2013 4:29:51 PM UTC+2,

[web2py] Re: SQLFORM.factory and list:integer error

2013-06-20 Thread Martin Barnard
Upgraded, but the error is still there. It's failing at the SQLFORM validation in dal.py, I don't even get the chance to access session variables myself. Also, list:integer fields leave an empty field behind Is there a way from within the DAL to remove empty entries on list:integer (as I can't

[web2py] Re: SQLFORM.factory and list:integer error

2013-06-20 Thread Martin Barnard
That code listing is from dal.py. I didn't really want to poke too much at that as I haven't had time to examine it too deeply. I should probably upgrade to latest web2py before trying anything else :) */scurries off to upgrade the server...* On Thursday, June 20, 2013 12:45:28 AM UTC+3, Niphl

[web2py] Re: SQLFORM.factory and list:integer error

2013-06-19 Thread Niphlod
it's a bug reproduceable only if you leave one empty field. BTW, you're parsing it wrong given a single field filled with 1234, you get [1,2,3,4] back. you should do vars = form.vars.employees if vars: if form.vars.employees: if On Wednesday, June 19, 2013 8:22:52 PM UTC+2, Martin B

[web2py] Re: SQLFORM.factory

2013-04-17 Thread Domagoj Kovač
This works: {{=form.custom.label[asset_class_attribute. asset_attribute_id.name]}} {{=form.custom.widget[asset_class_attribute. asset_attribute_id.name]}} Thanks! -- --- You received this message because you are subscribed to the Google Groups "web2py-

[web2py] Re: SQLFORM.factory

2013-04-17 Thread Domagoj Kovač
Thanks guys! I will try it. -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.goo

[web2py] Re: SQLFORM.factory

2013-04-17 Thread Anthony
> {{name = asset_class_attribute.asset_attribute_id.name > }} > {{=form.custom.label.name}} > {{=form.custom.widget.name}} > > {{=form.custom.label[name]}} {{=form.custom.widget[name]}} Or maybe simplify as follows: In the controller:

[web2py] Re: SQLFORM.factory

2013-04-17 Thread Niphlod
prepare a list of "name"s and return that to make it usable in the view then {{for nm in name:}} {{=form.custom.label['nm']}} {{=form.custom.widget['nm']}} {{pass}} On Wednesday, April 17, 2013 5:01:08 PM UTC+2, Domagoj Kovač wrote: > > Hi, > > i am trying to make a form with dinamic f

[web2py] Re: SQLFORM.factory does not update record with upload field

2013-04-08 Thread Massimo Di Pierro
The workflow is ambiguous. You are not editing a record therefore it is not clear whether an empty submission means you want to keep or remove the default. It thinks you want to remove it. If you want to keep it, still, it is not a proper default for the input (since it is no a fieldstorage to

[web2py] Re: SQLFORM.FACTORY editing a document. Save reports no upload files

2013-04-06 Thread Massimo Di Pierro
what are the models? On Tuesday, 2 April 2013 12:19:12 UTC-5, Ramos wrote: > > Back to business after almost 2 months i try again to use sqlform.factory > to create and edit documents > My problem was to generate the link > i rearranged my code as follows > > > #if edit a document > if request.a

[web2py] Re: SQLFORM.FACTORY editing a document. Save reports no upload files

2013-04-03 Thread António Ramos
No ideas? 2013/4/2 António Ramos > Back to business after almost 2 months i try again to use sqlform.factory > to create and edit documents > My problem was to generate the link > i rearranged my code as follows > > > #if edit a document > if request.args(0): > > row=db((db.trabalhador

Re: [web2py] Re: SQLFORM.factory and uploaded files. where is the link?

2013-04-02 Thread António Ramos
Back to business after almost 2 months i try again to use sqlform.factory to create and edit documents My problem was to generate the link i rearranged my code as follows #if edit a document if request.args(0): row=db((db.trabalhador.id==request.args(0))).select().first() empre

  1   2   3   >