Validating a field by querying another table

A place for users and developers of the Xataface to discuss and receive support.

Validating a field by querying another table

Postby rleyba » Mon Oct 24, 2011 3:09 am

Hi Steve,

I have a requirement wherein before a record is saved in my 'Devices' table, the 'Devicename' field in this table will query another table (called 'Masterlist') containing the masterlist of devices and then NOT save the record if the device is not on that Masterlist. I saw this posting --> http://xataface.com/documentation/how-t ... validation but it doesn't do a table lookup of another table.

I can't use a dropdown list (widget) since the devices list could be many thousands of records long and it will annoy the users if they have to scroll down the list each time.

I looked up the Wiki but couldn't find a relevant post. Could you point me in the right direction?

thanks very much.
rleyba
 
Posts: 53
Joined: Sat Dec 04, 2010 3:50 pm

Re: Validating a field by querying another table

Postby shannah » Mon Oct 24, 2011 1:59 pm

Why not use a lookup widget for this? The lookup widget doesn't load all the options, it allows the user to filter results from another table.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Validating a field by querying another table

Postby ADobkin » Wed Oct 26, 2011 4:09 am

Steve, on a related note, should the lookup widget dynamic filter option work in the currently released version 1.3rc6? I'd like to use it in some of my tables, but I couldn't seem to make it work. The wiki page indicates that it requires version 1.3.1. Is that correct?

http://xataface.com/wiki/lookup

Thanks,
Alan
ADobkin
 
Posts: 195
Joined: Mon Oct 22, 2007 7:31 pm
Location: Atlanta, GA, USA

Re: Validating a field by querying another table

Postby shannah » Wed Oct 26, 2011 9:43 am

It is not in 1.3rc6. It is, however in the 1.3.x SVN branch.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Validating a field by querying another table

Postby ADobkin » Thu Oct 27, 2011 9:00 pm

shannah wrote:It is, however in the 1.3.x SVN branch.


Are you sure it is in 1.3.x? I don't see any mention of the dynFilters option in HTML/QuickForm/lookup.php in the latest 1.3.x SVN branch (rev. 2888). However, I do see it in the 1.5.x SVN branch.

I would migrate to either 1.3.x or 1.5.x for this feature based on your recommendation, but I had the impression that 1.5.x is not considered safe/stable for production use.
ADobkin
 
Posts: 195
Joined: Mon Oct 22, 2007 7:31 pm
Location: Atlanta, GA, USA

Re: Validating a field by querying another table

Postby shannah » Fri Oct 28, 2011 9:20 am

Looks like you're right. 1.5.x really is a snapshot from the trunk half-way through 2.0 development. I created it because I had some clients running straight off the trunk and I wanted to "freeze" the state of their version to prevent accidentally updating.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Validating a field by querying another table

Postby ADobkin » Wed Nov 02, 2011 12:49 am

Okay, thanks. I decided to take the plunge and migrate to 1.5.x, because my application really needs this feature. I have found two bugs so far. I have added both to the tracker:

0000897: Errors generated with validators:maxlength = 0

0000906: Lookup widget dynamic filter ignored when adding new related record
ADobkin
 
Posts: 195
Joined: Mon Oct 22, 2007 7:31 pm
Location: Atlanta, GA, USA


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 28 guests

Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved