[web2py] Re: Hooking up Validation to Client-Created Form Elements

2013-09-15 Thread Shawn Wheatley
Answering my own question, I tried creating a matching SELECT, INPUT, etc. 
for my FORM object, and that did automatically hook up the server side 
validation. The code behind all this is pretty unwieldy. Is there some sort 
of best practice for creating form elements on the client in web2py?

-Shawn

On Saturday, September 14, 2013 9:33:44 PM UTC-4, Shawn Wheatley wrote:

 I'm working on an app with a master/detail-style view with a number of 
 detail lines that can be increased on the client. Right now, I'm using 
 jQuery to clone the table row of controls above and renaming the form 
 elements (named following a pattern of item___001, item___002, etc.) 
  This works great, except now I need to hook up validation to my form as 
 well. If the elements are added server side (for example, on my edit/update 
 action when I read from the DB, I create a row of form elements for every 
 item returned) this all works fine. But my client side clone is not 
 properly hooking up the elements for server side validation when I submit.

 I think I read in another thread that the post variables (or rather, the 
 names of the form elements) must match those of a form helper object on the 
 server. So, if I have added a select with the name item___003, I would 
 need to have a SELECT() with the same name on the server side. My question 
 is, what's the correct way to create this object? Do I add it anywhere on 
 the FORM() and just make it hidden? If the validation fails, I don't want 
 to end up somehow with my client and server representations of this form 
 element out of sync somehow.

 -Shawn


-- 
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-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.google.com/groups/opt_out.


[web2py] Hooking up Validation to Client-Created Form Elements

2013-09-14 Thread Shawn Wheatley
I'm working on an app with a master/detail-style view with a number of 
detail lines that can be increased on the client. Right now, I'm using 
jQuery to clone the table row of controls above and renaming the form 
elements (named following a pattern of item___001, item___002, etc.) 
 This works great, except now I need to hook up validation to my form as 
well. If the elements are added server side (for example, on my edit/update 
action when I read from the DB, I create a row of form elements for every 
item returned) this all works fine. But my client side clone is not 
properly hooking up the elements for server side validation when I submit.

I think I read in another thread that the post variables (or rather, the 
names of the form elements) must match those of a form helper object on the 
server. So, if I have added a select with the name item___003, I would 
need to have a SELECT() with the same name on the server side. My question 
is, what's the correct way to create this object? Do I add it anywhere on 
the FORM() and just make it hidden? If the validation fails, I don't want 
to end up somehow with my client and server representations of this form 
element out of sync somehow.

-Shawn

-- 
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-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.google.com/groups/opt_out.


[web2py] PyCharm to Support web2py in the 3.0 release

2013-03-29 Thread Shawn Wheatley
According to their roadmap for 3.0:

http://confluence.jetbrains.com/display/PYH/PyCharm+3.0+Roadmap

web2py support is the 2nd bullet on the list. The feature is not marked as 
having been started or completed, but they are targeting a fall 2013 
release.

Shawn

-- 

--- 
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.google.com/groups/opt_out.




[web2py] SQLFORM.grid/smartgrid: passing different fields to editargs for parent and child

2013-03-26 Thread Shawn Wheatley
I'm trying to edit a different subset of fields when editing records for a 
parent table and a child table. Looking at the source for SQLFORM, it looks 
like the dictionary passed to editargs is merged on-demand with the 
formargs dictionary. This is causing errors for me when editing the child 
table, because it uses the same list of fields. There seems to be no 
mechanism to pass dictionaries of tablename/value to various arguments in 
editargs. Has anyone else encountered an issue with grid/smartgrid when 
editing a child table with editargs set for the parent?

Shawn

-- 

--- 
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.google.com/groups/opt_out.




[web2py] Re: Query Not Supported: (1054, Unknown column 'daily_counts.add_date' in 'order clause') No records f

2013-03-24 Thread Shawn Wheatley
I am seeing a similar issue using smartgrid for a master-detail invoice 
view. When clicking on the link for my detail child records, I get an error 
saying the column I'm ordering by in the master doesn't exist. Has this 
been resolved yet? Dan, did you open a ticket for this?

Shawn

On Monday, February 25, 2013 9:01:57 PM UTC-5, Dan Kozlowski wrote:

 *Massimo,

 When I removed the orderby clause it solved problem with the error 
 message. but I still need to sort the grid in desc order.
 *




 def dailycounts():
 grid=SQLFORM.smartgrid(db.daily_counts,  
 user_signature=False,create=False,editable=False,deletable=False,*
 orderby=~db.daily_counts.add_date*, 
 fields=[db.daily_counts.add_date,db.daily_counts.encrypt_count,db.daily_counts.decrypt_count,db.daily_counts.error_count,db.daily_counts.cycle_count,db.daily_counts.directory_create_count,db.daily_counts.client_add_count])
 return locals()


-- 

--- 
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.google.com/groups/opt_out.




[web2py] Re: Query Not Supported: (1054, Unknown column 'daily_counts.add_date' in 'order clause') No records f

2013-03-24 Thread Shawn Wheatley
Hmmm... I also just discovered that specifying fields on the smartgrid 
causes issues with the child tables. Is there a way to pass another list of 
fields for the child table?

On Sunday, March 24, 2013 11:17:24 PM UTC-4, Shawn Wheatley wrote:

 I am seeing a similar issue using smartgrid for a master-detail invoice 
 view. When clicking on the link for my detail child records, I get an error 
 saying the column I'm ordering by in the master doesn't exist. Has this 
 been resolved yet? Dan, did you open a ticket for this?

 Shawn

 On Monday, February 25, 2013 9:01:57 PM UTC-5, Dan Kozlowski wrote:

 *Massimo,

 When I removed the orderby clause it solved problem with the error 
 message. but I still need to sort the grid in desc order.
 *




 def dailycounts():
 grid=SQLFORM.smartgrid(db.daily_counts,  
 user_signature=False,create=False,editable=False,deletable=False,*
 orderby=~db.daily_counts.add_date*, 
 fields=[db.daily_counts.add_date,db.daily_counts.encrypt_count,db.daily_counts.decrypt_count,db.daily_counts.error_count,db.daily_counts.cycle_count,db.daily_counts.directory_create_count,db.daily_counts.client_add_count])
 return locals()



-- 

--- 
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.google.com/groups/opt_out.




[web2py] Re: Query Not Supported: (1054, Unknown column 'daily_counts.add_date' in 'order clause') No records f

2013-03-24 Thread Shawn Wheatley
I figured it out. I didn't read the section of the docs on smartgrid well 
enough. I now see you *can* pass multiple values to orderby and fields as a 
dictionary, with the table names as the keys.

Shawn

On Sunday, March 24, 2013 11:21:29 PM UTC-4, Shawn Wheatley wrote:

 Hmmm... I also just discovered that specifying fields on the smartgrid 
 causes issues with the child tables. It uses the same fields as the parent, 
 which don't exist and therefore displays empty rows. Is there a way to pass 
 another list of fields for the child table?

 On Sunday, March 24, 2013 11:17:24 PM UTC-4, Shawn Wheatley wrote:

 I am seeing a similar issue using smartgrid for a master-detail invoice 
 view. When clicking on the link for my detail child records, I get an error 
 saying the column I'm ordering by in the master doesn't exist. Has this 
 been resolved yet? Dan, did you open a ticket for this?

 Shawn

 On Monday, February 25, 2013 9:01:57 PM UTC-5, Dan Kozlowski wrote:

 *Massimo,

 When I removed the orderby clause it solved problem with the error 
 message. but I still need to sort the grid in desc order.
 *




 def dailycounts():
 grid=SQLFORM.smartgrid(db.daily_counts,  
 user_signature=False,create=False,editable=False,deletable=False,*
 orderby=~db.daily_counts.add_date*, 
 fields=[db.daily_counts.add_date,db.daily_counts.encrypt_count,db.daily_counts.decrypt_count,db.daily_counts.error_count,db.daily_counts.cycle_count,db.daily_counts.directory_create_count,db.daily_counts.client_add_count])
 return locals()



-- 

--- 
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.google.com/groups/opt_out.




[web2py] CSV Import Error: ValueError: invalid literal for int() with base 10: ''

2013-03-07 Thread Shawn Wheatley
Hi All,

I've been trying to track down an issue importing data from a legacy 
application I'm converting over to web2py. I have exported the data as 
described in the documentation (Table Foo, header line, data, 2 rows 
in-between, END at the end) but I'm getting this traceback when trying to 
import:

web2py Shell (2, 4, 2, 'stable', datetime.datetime(2013, 3, 4, 3, 26, 
21))In [1] : db.import_from_csv_file(open('testout.csv', 'rb'))
Traceback (most recent call last):
  File /home/mdipierro/make_web2py/web2py/gluon/contrib/shell.py, line 
234, in run
  File string, line 1, in module
  File /home/mdipierro/make_web2py/web2py/gluon/dal.py, line 7936, in 
import_from_csv_file
  File /home/mdipierro/make_web2py/web2py/gluon/dal.py, line 8596, in 
import_from_csv_file
  File /home/mdipierro/make_web2py/web2py/gluon/dal.py, line 8568, in fix
ValueError: invalid literal for int() with base 10: ''

Unfortunately, the exception does tell me which line the import bailed on, 
so I can't tell where to start looking for bad data. I'm currently running 
this through the shell. Would I be better off putting this in a controller 
so I could get better traceback information from a ticket?

Thanks,
Shawn

-- 

--- 
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.google.com/groups/opt_out.




[web2py] Re: CSV Import Error: ValueError: invalid literal for int() with base 10: ''

2013-03-07 Thread Shawn Wheatley
I have opened ticket 1368: 
http://code.google.com/p/web2py/issues/detail?id=1368

In the meantime, do you have any suggestions for how to proceed? I'm 
considering putting the statement in a controller and triggering it from 
the web so I get a ticket with a stack trace and more info about the data 
being processed at that time. Does web2py use the logging framework at all? 
From what I can see in dal.py, it doesn't appear to be.

Thanks,
Shawn

On Thursday, March 7, 2013 12:42:27 PM UTC-5, Massimo Di Pierro wrote:

 Please open a ticket asking for better info on failed import.

 On Wednesday, 6 March 2013 22:58:47 UTC-6, Shawn Wheatley wrote:

 Hi All,

 I've been trying to track down an issue importing data from a legacy 
 application I'm converting over to web2py. I have exported the data as 
 described in the documentation (Table Foo, header line, data, 2 rows 
 in-between, END at the end) but I'm getting this traceback when trying to 
 import:

 web2py Shell (2, 4, 2, 'stable', datetime.datetime(2013, 3, 4, 3, 26, 
 21))In [1] : db.import_from_csv_file(open('testout.csv', 'rb'))
 Traceback (most recent call last):
   File /home/mdipierro/make_web2py/web2py/gluon/contrib/shell.py, line 
 234, in run
   File string, line 1, in module
   File /home/mdipierro/make_web2py/web2py/gluon/dal.py, line 7936, in 
 import_from_csv_file
   File /home/mdipierro/make_web2py/web2py/gluon/dal.py, line 8596, in 
 import_from_csv_file
   File /home/mdipierro/make_web2py/web2py/gluon/dal.py, line 8568, in 
 fix
 ValueError: invalid literal for int() with base 10: ''

 Unfortunately, the exception does tell me which line the import bailed 
 on, so I can't tell where to start looking for bad data. I'm currently 
 running this through the shell. Would I be better off putting this in a 
 controller so I could get better traceback information from a ticket?

 Thanks,
 Shawn



-- 

--- 
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.google.com/groups/opt_out.