PBDR.COM

About   -   Contact   -   Purchase   -   Search   -   What's New

 
 
Validating Editable Dropdown Datawindows
Editable Dropdown Datawindows are great for users but require a little more work on behalf of the programmer. The users get greater flexibility because they can type in a code or type the first few letters of a description. Programmers get to write more code.

When it comes to saving the data you will quite often want to validate the users input because unlike a non Editable Dropdown Datawindow the user may have entered data that is not in the list. It would be nice to handle this on the client so that we can display some nice message to the user and reduce the work of the backend.

The following are three methods of checking the users data:

  • Perform a SQL select to make sure the data is valid. Yuck! this is v.slow and should be avoided like the plague.
  • You can get the handle to the Child Datawindow that is the Editable Dropdown Datawindow and then do a Find() against the Datawindow to see if the row exists. This would be much faster than the first method.
  • Or you can use a feature of the Dropdown Datawindow that will automatically scroll to the row in the Dropdown Datawindow if the value typed exists. Then do a getchild on the Editable Dropdown Datawindow as before only instead of doing a find you can check the value of the Editable Dropdown Datawindow against the value of the current row in the Child Datawindow.

There not much time difference of the last two for a few rows but for large DDDW's the latter will be a bit quicker. Either way is much faster than performing a SELECT and also reduces the hits to the database. This would be a good function to add to your base class objects or Datawindow service.

 

Top of Page

Legal Notice

Ken Howe 2011