Print Page | Close Window

Validating lookups

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=713
Printed Date: 11-Jun-2026 at 6:26am


Topic: Validating lookups
Posted By: antalakas
Subject: Validating lookups
Date Posted: 04-Mar-2008 at 2:50pm
Let 's say i build a form to handle INSERT/DELETE/UPDATE in a database table.
My table has a relation to a lookup table, and i feel like setting it to mandatory.
I follow mapping rules and implement the form.

I use the UI and insert a new record. The Create method in the object Model for my table
does not set initial value for the lookup.

In this case the lookup fills the gap with a null entity value and the form is working.

When i am trying to save a message is displayed stating that "A foreign key constraint... " etc.
As you remember the lookup was required but not set...

How can i inform my users for the inability to save BEFORE they try to press the save button?


Thank you

Andreas





Replies:
Posted By: eileenv
Date Posted: 18-Mar-2008 at 1:42pm
One way to accomplish this would be to implement a verifier that checks for foreign key values that are null. Then you can perform instance verification prior to a save and notify users of invalid data before the save occurs.



Print Page | Close Window