validate if record already exists

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

validate if record already exists

Postby entr04y » Thu Nov 15, 2012 10:18 am

Hi,

I have an application where I input invoices received that are tied to a specific number. The number is unique across the invoices and used for the primary key on the table. Is it possible to validate the field that contains that number when entering it as a new record? What I mean is if I receive a duplicate invoice or am not sure if I entered it yet, can Xataface pop up a warning on the add new item form when I type an invoice number that already exists in the database into the field prior to me hitting save? It looks like field name__validate only works after hitting submit (I don't want to fill out the entire form just to find the record already exists)

Thanks!
entr04y
 
Posts: 10
Joined: Thu Oct 08, 2009 6:44 am

Re: validate if record already exists

Postby shannah » Thu Nov 15, 2012 10:25 am

You would need to implement some custom javascript for this. You would do this in 2 parts:
1. Create a custom action that takes an invoice number and tells you if it exists. Probably returns a JSON response.
2. Create a javascript function that makes an ajax call to your action, and attach this to your invoice number field's change event.

-Steve
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: validate if record already exists

Postby entr04y » Thu Nov 15, 2012 10:44 am

OK... I'll give that a go...

Thanks!
entr04y
 
Posts: 10
Joined: Thu Oct 08, 2009 6:44 am


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 16 guests

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