[web2py] Re: Odd MySQL connection problem

2019-09-22 Thread backseat
Resolution, in case anyone else sees this:

I had imported the database from our production system. The database 
includes a view. The database username, and thus the view creator name, are 
different on the production vs development system. That means the view is 
not visible to the MySQL user on the development system. Found by changing 
the connection string to use the MySQL root user, which gave more verbose 
error messages.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/c1b26b51-06aa-4a2e-b80f-54c26b8c87cd%40googlegroups.com.


[web2py] Odd MySQL connection problem

2019-09-18 Thread backseat
I'm getting:

...
File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 50, in 
defaulterrorhandler
raise errorvalue
OperationalError: (1045, "Access denied for user 'pytrack2'@'localhost' (using 
password: YES)")


The password, user and database are accessible from the command line.

How can I debug this?

What output can I show here to help?

Thanks,
Keith

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/9636cf4b-bbbe-4b8f-b4fc-72c10127a1f6%40googlegroups.com.


[web2py] Re: Select records NOT in a set

2019-09-16 Thread backseat
Fabulous. Thanks 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 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/22d44f1c-a490-4249-bb57-664ce07f4ef6%40googlegroups.com.


[web2py] Select records NOT in a set

2019-09-15 Thread backseat
I have a list of members that I want to schedule for certain duties. One 
table lists the people:

db.define_table(
'members',
Field('fullname', type='string', label='Name'),
[...]
)

I select members from that table according to certain criteria, but I want 
to not select them if they are unavailable on a given date.

I have:

db.define_table(
'unavailable',
Field('the_date', type='date', label='Date'),
Field('who', type='reference members', label='Name')
)

It is possible, given a date and the other selection criteria, to get a 
list of available members for the date in question?

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/4cfef017-598a-499e-9a2b-f4a407b26308%40googlegroups.com.


[web2py] Re: Can't connect to MySQL

2019-09-10 Thread backseat
This code fails:

uri = configuration.get('db.uri')
print uri
db = DAL(uri)

The uri printed is:

'mysql://rota:rota@localhost/rota?set_encoding=utf8mb4'

This code works:

db = DAL('mysql://rota:rota@localhost/rota?set_encoding=utf8mb4')

That's exactly the same URI (it was copy and pasted in Vim). 

I'm moving on.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/9c59444e-1b68-445a-be0d-eb821bc55b48%40googlegroups.com.


[web2py] Re: Can't connect to MySQL

2019-09-10 Thread backseat

>
> MySQL is listening on the default port:
>

$ telnet localhost 3306
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
c
5.5.5-10.3.17-MariaDB-0+deb10u1�a3y(W]OS��-��5KZaY|$920;vmysql_native_password^CConnection
 
closed by foreign host.

 

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/6d68c56b-ef9c-427e-a88b-88a089178a83%40googlegroups.com.


[web2py] Can't connect to MySQL

2019-09-09 Thread backseat
I've just downloaded web2py 2.18.5 and set the MySQL URI as follows:

uri   = 'mysql://rota:rota@localhost/rota'


Web2py gives:

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.

Traceback (most recent call last):
  File "/home/kae/web2py-2.18.5/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
  File "/home/kae/web2py-2.18.5/applications/rota/models/db.py" 
, line 47, in 

check_reserved=['all'])
  File "/home/kae/web2py-2.18.5/gluon/packages/dal/pydal/base.py", line 171, in 
__call__
obj = super(MetaDAL, cls).__call__(*args, **kwargs)
  File "/home/kae/web2py-2.18.5/gluon/packages/dal/pydal/base.py", line 477, in 
__init__
"Failure to connect, tried %d times:\n%s" % (attempts, tb)
RuntimeError: Failure to connect, tried 5 times:
Traceback (most recent call last):
  File "/home/kae/web2py-2.18.5/gluon/packages/dal/pydal/base.py", line 442, in 
__init__
self._dbname = REGEX_DBNAME.match(uri).group()
AttributeError: 'NoneType' object has no attribute 'group'




I can access the db from the command line:

$ mysql -h localhost -u rota -prota rota
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 187
Server version: 10.3.17-MariaDB-0+deb10u1 Debian 10

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input 
statement.

MariaDB [rota]>

I can see Web2py can't connect to MySQL, but I can't find any clues as to 
why. 

Where should I look to try to resolve this?

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/24964d5f-3d83-4b34-b802-90becf914eff%40googlegroups.com.


[web2py] Running web2py in a container / Kubernetes

2019-07-11 Thread backseat
We're looking to move a web2py app to run in a container under Kubernetes.

I'm interested in experiences of running web2py in a non-persistent 
container. In particular, how have people handled the app/databases 
directory?

Thanks

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/88be3802-aa08-423e-897f-d1778f0bc139%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: How would I get a sum of virtual fields?

2018-03-08 Thread backseat
Thanks Anthony. It almost works (but it fails in an odd way). I was getting 
some odd results, and I've narrowed it down to this:

In [10]: task_duration = (db.t_periods.f_end - db.t_periods.f_start) 
 
In [11]: results = db(query).select(p.id, p.f_start, p.f_end, task_duration
).as_list() 
 
In [12]: results 
Out[12]:  
[{'_extra': {'(t_periods.f_end - t_periods.f_start)': 118.0}, 
  't_periods': {'f_end': datetime.datetime(2018, 1, 8, 13, 59, 21), 
   'f_start': datetime.datetime(2018, 1, 8, 13, 58, 3), 
   'id': 37278L}}]


That shows a task_duration of 118.0, whereas actually it's 1:18.

The datatypes appear correct:

In [16]: p.f_start.type 
Out[16]: 'datetime' 
 
In [17]: p.f_end.type 
Out[17]: 'datetime'

I'm not sure why datetime - datetime is given a float answer. 

Keith

-- 
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/d/optout.


[web2py] How would I get a sum of virtual fields?

2018-03-08 Thread backseat
OK, I know I can't get a sum of virtual fields, but here's what I'm trying 
to do:

db.define_table(
't_periods',
Field('f_start', type='datetime', label=T('Start time')),
Field('f_end', type='datetime', label=T('End time')),
Field('f_task', type='reference t_tasks', label=T('Task')),

...)

db.t_periods.f_duration = Field.Virtual('f_duration',
lambda row: row.f_end - row.f_start)



So, for any one task there may be multiple periods of time. I would like a 
list of tasks and the total time allocated to each. I tried this:

task_duration = db.t_periods.f_duration.sum()

results = db(query).select(db.t_tasks.f_name, task_duration, 
   groupby=db.t_tasks.f_name)

That gives me the error:

AttributeError: 'FieldVirtual' object has no attribute 'sum'

That makes sense to me, but what would be a good strategy to get a list of 
tasks and the total duration for each?

Thanks

-- 
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/d/optout.


[web2py] Re: Update form fields on submit

2017-10-15 Thread backseat
Thanks, Bernhard.

The solution I ended up with is quite messy, but it does work:

# Set defaults
if request.get_vars:
filter_bar.vars.from_date = datetime.datetime.strptime(
request.get_vars.from_date, "%Y-%m-%d").date()
filter_bar.vars.to_date = datetime.datetime.strptime(
request.get_vars.to_date, "%Y-%m-%d").date()
else:
filter_bar.vars.from_date = last_day_last_month.replace(day=1)
filter_bar.vars.to_date = last_day_last_month

# Submit form
if filter_bar.validate(keepvalues=True):
if filter_bar.vars.daterange:
daterange = int(filter_bar.vars.daterange)
if daterange > 0:
from_date, to_date = get_daterange_dates(daterange)
redirect(URL(vars=dict(from_date=from_date, 
to_date=to_date)))



>

-- 
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/d/optout.


[web2py] Update form fields on submit

2017-10-15 Thread backseat
I have a page that is a report, and at the top of that page is a form with 
a 'from' and 'to' date field so that the user can select the date range to 
report on. By default, the dates select and the first to the last of last 
month. That works fine.

I want to add a combo that will allow the selection of a predefined period, 
such as "last week". That works fine, too, but when selecting 'last week', 
I want to update the 'to' and 'from' date fields accordingly, and I can't 
make that work.

Here's an example with hardcoded dates for for simplicity:

def summary_report():

# Calculate default dates
last_day_last_month = (datetime.datetime.now().replace(day=1) -
   datetime.timedelta(days=1)).date()
from_date = last_day_last_month.replace(day=1)
to_date = last_day_last_month
date_range_list = [
(0, "Select Date Range"),
(1, "Last Week"),
]

# Non-DB field definitions
from_date_field = Field('from_date', type='date', label=T('From date'))
to_date_field =  Field('to_date', type='date', label=T('To date'))
date_range_field = Field('daterange', type='string', label=T('dr'))
date_range_field.requires = IS_IN_SET(date_range_list, zero=None)

# Build filter bar
filter_bar = SQLFORM.factory(
from_date_field, to_date_field, date_range_field,
formstyle='divs',
submit_button='Filter',
)

# Set defaults
filter_bar.vars.from_date = from_date
filter_bar.vars.to_date = to_date

# Submit form
filter_bar.validate(keepvalues=True,onvalidation=do_daterange)
from_date = filter_bar.vars.from_date
to_date = filter_bar.vars.to_date

# Build query
[...]


def do_daterange(filter_bar):

daterange = int(filter_bar.vars.daterange)
  if daterange > 0:
filter_bar.vars.from_date = datetime.date(2017,1,1)
filter_bar.vars.to_date = datetime.date(2017,6,30)



-- 
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/d/optout.


Re: [web2py] Update hidden field / id for hidden field

2017-07-06 Thread backseat
You're right, of course.I, too, get frustrated by people asking the wrong 
question, and now I'm doing it...

I have a form that requires a 'from_date' and a 'to_date', which is 
currently implemented using two fields. I like the idea of using the 
'daterangepicker' tool, particularly the predefined date ranges 
(http://www.daterangepicker.com/#ex4). Within the js that implements the 
predefined ranges, it's relatively simple to update two hidden fields (my 
from_date and to_date) without worrying about the display format in the 
single daterangepicker text box. However, I think it might be easier just 
to parse the daterangepicker box anyway.

Thanks for the pointer.

-- 
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/d/optout.


[web2py] Update hidden field / id for hidden field

2017-07-06 Thread backseat
I want to use javascript to update a hidden field, but I can't find a way 
to give a hidden field an id which would make it much easier to update.

SQLFORM.factory(..., hidden=dict(a="",b=""))



will create the hidden fields, but not with an id.

What's the best way to create non-database hidden fields with an id?

-- 
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/d/optout.


[web2py] DAL: why is "field == None" not "field is None"?

2017-01-04 Thread backseat
My PEP8 checker tells me that:

db.table.field == None

should be

db.table.field is None

But that doesn't evaluate correctly. Why?

(I did search for this but couldn't find it discussed before: apologies if 
I missed it).

Thanks

-- 
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/d/optout.


[web2py] Patch: LDAP AUTH TLS

2015-07-31 Thread backseat
I found that I was unable to authenticate to an OpenLDAP server running TLS 
on port 389 (which is the recommended way apparently). The following patch 
to ldap_auth.py fixes things for me; YMMV.

Please add to upstream source if helpful.

--- gluon/contrib/login_methods/ldap_auth.py.original   2015-07-31 23:22:
45.931751184 +0100
+++ gluon/contrib/login_methods/ldap_auth.py2015-07-31 23:19:
14.116922831 +0100
@@ -33,6 +33,7 @@
   group_name_attrib='cn',
   group_member_attrib='memberUid',
   group_filterstr='objectClass=*',
+  tls=False,
   logging_level='error'):
 
 """
@@ -80,6 +81,13 @@
 If ldap is using GnuTLS then you need cert_file="..." instead cert_path
 because cert_path isn't implemented in GnuTLS :(
 
+To enable TLS, set tls=True:
+
+auth.settings.login_methods.append(ldap_auth(
+server='my.ldap.server',
+base_dn='ou=Users,dc=domain,dc=com',
+tls=True))
+
 If you need to bind to the directory with an admin account in order to
 search it then specify bind_dn & bind_pw to use for this.
 - currently only implemented for Active Directory
@@ -610,6 +618,8 @@
 ldap_port = 389
 con = ldap.initialize(
 "ldap://"; + ldap_server + ":" + str(ldap_port))
+if tls:
+con.start_tls_s()
 return con
 
 def get_user_groups_from_ldap(username,


-- 
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/d/optout.


[web2py] Re: OpenLDAP and TLS auth example, please

2015-07-29 Thread backseat
Hmm, we may have an LDAP server issue. Ignore for now; sorry for the noise.

-- 
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/d/optout.


[web2py] OpenLDAP and TLS auth example, please

2015-07-29 Thread backseat
Does anyone have an example of configuring an OpenLDAP TLS connection for 
authentication?

I've tried:

auth.settings.login_methods.append(ldap_auth(
server='my.ldap.server',
base_dn='ou=users,dc=my,dc=ldap,dc=server',
secure=True,
port=389,
))

...but that fails with "Invalid login" (using a valid, existing OpenLDAP 
username/pw).

Removing the "secure=True" gets me a "confidentiality required" back from 
the LDAP server.

Removing the "port=389" uses port 636 (as I'd expect); the OpenLDAP+TLS 
server is definitely listening on 389.

Thoughts? Suggestions?

Thanks.

-- 
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/d/optout.


[web2py] Re: How to use AJAX within a SQLFORM.grid 'add' form

2014-03-30 Thread backseat
On Sunday, 30 March 2014 14:08:38 UTC+1, Anthony wrote:
>
> Would help to see the controller code.
>

Here's the code from a test app I've put together to simplify:

def index():
grid = SQLFORM.grid(db.t_dogs,
create=True,
csv=False,
deletable=False,
details=False,
editable=True,
paginate=100,
searchable=False,
)
return locals()


def echo():
print "in echo()"
#from gluon.debug import dbg
#dbg.set_trace()
return request.vars.name


What is "form", and why are "grid" and "form" inside BEAUTIFY?
>

Here's the simplified view:

{{extend 'layout.html'}}

Target



   


DOGS
{{=BEAUTIFY(grid)}}


They're inside BEAUTIFY to keep it simple for now: that is how they are 
after the application wizard has run.
 

> What are you really trying to do?
>

Ultimately, I want the Add from from a SQLFORM.grid to have a dropdown 
combo and a text area (amongst other things). I want the text area to be 
populated with default text when the dropdown changes, and I was going to 
do this with AJAX.

The simplified application shown above demonstrates the problem. When the 
grid is displayed, the AJAX call works as expected. When the grid "Add" 
form is displayed and characters are typed in the input area, the echo() 
function is not called.

-- 
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/d/optout.


[web2py] Re: How to use AJAX within a SQLFORM.grid 'add' form

2014-03-30 Thread backseat
Hi All

Am I doing something wrong on this group?

I've highlighted what looks like a bug to me, but I've had no response. Is 
this the wrong place to discuss what looks like a bug?

Thanks
Keith

-- 
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/d/optout.


[web2py] Re: How to use AJAX within a SQLFORM.grid 'add' form

2014-03-26 Thread backseat
I have slightly more information now. Once the SQLFORM.grid 'Add' form is 
displayed, typing in the 'name' form does not call the echo() function.

This seems like a bug to me.

The echo() function is called as expected when the grid is shown, but not 
when the Add form is shown - but there is something going on because the 
display is updated (broken) as described in the original post.

-- 
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/d/optout.


[web2py] Re: How to use AJAX within a SQLFORM.grid 'add' form

2014-03-25 Thread backseat

>
> Bump...is is possible to use AJAX in a SQLFORM.grid Add 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 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/d/optout.


[web2py] Re: How to use AJAX within a SQLFORM.grid 'add' form

2014-03-17 Thread backseat
Thanks Derek, but I don't think that's it. The example in the book doesn't 
define a view for 'echo', and even I do define one that explicitly calls 
the grid view, the problem persists (is there a view for just the Add 
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 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/d/optout.


[web2py] Re: How to use AJAX within a SQLFORM.grid 'add' form

2014-03-16 Thread backseat
Is it expected that AJAX can be used within the Add form of a SQLFORM.grid? 
If so, what am I doing wrong (or is it a bug)?

Thanks,
Keith

-- 
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/d/optout.


[web2py] How to use AJAX within a SQLFORM.grid 'add' form

2014-03-13 Thread backseat
My SQLFORM.grid is based on a table that includes a field defined as a 
textarea.  When I add a new record using the grid 'Add' button, I want to 
update that textarea using AJAX.

My test view looks like this:

{{extend 'layout.html'}}
{{=' '.join(x.capitalize() for x in request.function.split('_'))}}

{{=BEAUTIFY(form)}}

{{=BEAUTIFY(grid)}}


   

{{if request.is_local:}}
{{=response.toolbar()}}
{{pass}}

The 'echo' function is just:

def echo():
return request.vars.name


When the SQLFORM.grid is showing, the AJAX works as expected.

When I click on the Add button, typing into the form defined above causes 
the original grid to be displayed in the 'target' area, and the content of 
the 'name' form is not included.

Is it possible to use AJAX within the Add form from SQLFORM.grid?

Thanks,
Keith

-- 
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/d/optout.


[web2py] Re: Update textarea when dropdown changes

2014-03-13 Thread backseat
I did a pretty poor job of explaining my problem. I'll post again and try 
to make it clearer.

-- 
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/d/optout.


[web2py] Update textarea when dropdown changes

2014-03-12 Thread backseat
I have a db table, t_services, that includes:

Field('f_service', type='string',
  label=T('Service')),
Field('f_default_specification', type='text',
  label=T('Default specification')),

Another table, t_line_items, includes:

Field('f_service', type='reference t_services',
  label=T('Service')),
Field('f_detail', type='text',
  label=T('Detail')),

I have a form to add to the t_line_items table that has a dropdown box for 
f_service and a textarea for f_detail. I'd like to update the textarea with 
the corresponding t_services.f_default_specification when the an item is 
selected in the dropdown.

I hope that makes sense. Any pointers to how to do this gratefully received.

Thanks.

-- 
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/d/optout.


[web2py] SQLFORM.grid: search and links

2012-01-29 Thread backseat
I've a couple of questions about SQLFORM.grid:

 - Is it possible to position the buttons/links created by the 'links' 
argument somewhere other than the end of the row? It feels as if the 
'fields' argument should be able to do this, but I can't see how.

 - Is it possible for the 'search' box to search linked tables? That may be 
asking a bit much...

Thanks