[web2py] Re: IS_IN_DB() validator only validating on form fields?

2014-03-10 Thread Anthony
Make sure you define it as a reference field, and then you can set notnull=True -- in that case, the database will not all NULL values in that field. Also, you can always set up database constraints outside of web2py using other database clients to alter table definitions. Anthony On Monday, M

[web2py] Re: IS_IN_DB() validator only validating on form fields?

2014-03-10 Thread Dan Why
Okay, so the doc clearly says the validators are for input field validations (chapter 7). What would be the recommended way to add referential integrity check for the database to avoid something like what I described? Also I am currently using SQLite (and I realize the result will vary dependin

Re: [web2py] Re: IS_IN_DB validator dropdown formatting

2014-02-12 Thread Jim S
Yes, I looked at many others as well. But, the requirement didn't deserve that much of my time on this project. We'll be just fine with the low-tech solution. But, opened my eyes for possibilities on other projects. Thanks again... --Jim On Wednesday, February 12, 2014 9:14:26 AM UTC-6, Ant

Re: [web2py] Re: IS_IN_DB validator dropdown formatting

2014-02-12 Thread Anthony
Note, there are many alternatives to ddslick -- that's just one I found with a quick search. On Wednesday, February 12, 2014 9:45:40 AM UTC-5, Jim S wrote: > > I've since abandoned working with ddslick for this function. Decided just > to go low tech and put the data into a single line in the I

Re: [web2py] Re: IS_IN_DB validator dropdown formatting

2014-02-12 Thread Jim Steil
I've since abandoned working with ddslick for this function. Decided just to go low tech and put the data into a single line in the IS_IN_DB dropdown. I couldn't find a control that worked the way I'd had it working in my previous TurboGears app utilizing dojo. I really like the ddslick widget b

Re: [web2py] Re: IS_IN_DB validator dropdown formatting

2014-02-12 Thread Anthony
{{=XML(customerList)}} On Tuesday, February 11, 2014 12:52:28 PM UTC-5, Jim S wrote: > > Thanks Anthony. Trying this but running into a problem generating the > json to use for the data. Keep getting a javascript error: > > SyntaxError: invalid property id > > data: [{"text": "Skygsslo Farms"

Re: [web2py] Re: IS_IN_DB validator dropdown formatting

2014-02-11 Thread Cliff Kachinske
Have you tried simplejson.dump()? On Tuesday, February 11, 2014 12:52:28 PM UTC-5, Jim S wrote: > > Thanks Anthony. Trying this but running into a problem generating the > json to use for the data. Keep getting a javascript error: > > SyntaxError: invalid property id > > data: [{"text": "Skygs

Re: [web2py] Re: IS_IN_DB validator dropdown formatting

2014-02-11 Thread Jim Steil
Thanks Anthony. Trying this but running into a problem generating the json to use for the data. Keep getting a javascript error: SyntaxError: invalid property id data: [{"text": "Skygsslo Farms", "descriptio On the python side I'm building it like this: for customer in db(customerQ

[web2py] Re: IS_IN_DB validator dropdown formatting

2014-02-11 Thread Anthony
I don't think you can put any additional HTML tags in an element, so you would probably have to use a Javascript plugin to render a custom dropdown (e.g., http://designwithpc.com/Plugins/ddSlick). Anthony On Tuesday, February 11, 2014 10:57:00 AM UTC-5, Jim S wrote: > > I'm looking for a way t

Re: [web2py] Re: IS_IN_DB validator

2011-04-24 Thread Stifan Kristi
nice share nik, thank you. i think IS_IN_DB(db, db.table_name.id, '%(field_name)s') is work too. On Sun, Apr 24, 2011 at 1:11 PM, niknok wrote: > Found the answer: orderby is supported. > > IS_IN_DB(dbset, field, orderby='mytable.myfield', ...) > > On Apr 24, 8:31 am, niknok wrote: > > Thanks.

[web2py] Re: IS_IN_DB validator

2011-04-24 Thread DenesL
Correct, sorry I misread your initial post. On Apr 24, 2:11 am, niknok wrote: > Found the answer: orderby is supported. > > IS_IN_DB(dbset, field, orderby='mytable.myfield', ...) > > On Apr 24, 8:31 am, niknok wrote: > > > > > > > > > Thanks. But I guess I did not explain myself properly. > >

[web2py] Re: IS_IN_DB validator

2011-04-23 Thread niknok
Found the answer: orderby is supported. IS_IN_DB(dbset, field, orderby='mytable.myfield', ...) On Apr 24, 8:31 am, niknok wrote: > Thanks. But I guess I did not explain myself properly. > > I would like the list to display the titles, but sorted by say the ID > field, or another field. > > Right

[web2py] Re: IS_IN_DB validator

2011-04-23 Thread niknok
Thanks. But I guess I did not explain myself properly. I would like the list to display the titles, but sorted by say the ID field, or another field. Right now, I do it like label='%(id)s%(title)s', but I'd like to display it without the ID. I hope this makes sense. On Apr 23, 10:30 pm, DenesL

[web2py] Re: IS_IN_DB validator

2011-04-23 Thread DenesL
Yes, use the label parameter e.g. IS_IN_DB(dbset, field, label='%(title)s', ...) On Apr 23, 8:59 am, niknok wrote: > Is there a way to sort the list generated by IS_IN_DB by another field > other than the one formatted for display? > > Thanks. > > /r > Nik