Subject Re: [IBO] Display custom "xxx is a required field" message
Author joseph osende
Hi, Mirco !

I'm new to IBO, but anyway I'd like to show
the solution that I'm actually using

1. create a constraint for your not nullable field

alter table <tableName> add constraint
check ( fieldName is Not Null ) ;

please make your <constraintName> short, unique,
and "auto descriptive", for example,


2. somewhere in your Delphi App, I do it in an on
'OnPostError' event, you can compare the name
of your constraint with the content of E.message,
something like :

if ( pos( constraintName, e.message ) <> 0 ) then
// the error is your nullable field related
// so you can display a customized message
// to the end-user
// 'cause your constraintName is unique
// the context is completely known
// display a message and suggestions
// set the appropriate value
// for the action to be taken
// abort, fail, etc.
end ;

3. toward a global solution...

In fact I've created a table containing
the constraints names, the customized messages,
and the suggestions, initialize an Array at my app's
startup and whenever I get an IB_Error and I try
to find in my array the row containing the
constraintName found in the TIB_Error.message
If the search succeeds, I can display the
corresponding message and suggestions.

Hope it can help


> Anyone knows how to display a custom message instead
> of IBO's built-
> in "xxx is a required field" message? I tried the
> database's onError
> event, but it gets only called when the database
> reports an error
> which in this case does not happen (IBO seems to
> check the required
> fields before posting - good, but how do I change
> the msg then?)
> Mirco
> ------------------------ Yahoo! Groups Sponsor
> IB Objects - direct, complete, custom connectivity
> to Firebird or InterBase
> without the need for BDE, ODBC or any
> other layer.
> - your IBO community
> resource for Tech Info papers,
> keyword-searchable FAQ, community code contributions
> and more !
> Your use of Yahoo! Groups is subject to

Do You Yahoo!? -- Une adresse @... gratuite et en fran├žais !
Yahoo! Mail :