Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Primary field validation

Status
Not open for further replies.

mnongkhlaw

Programmer
Feb 22, 2002
62
IN
Dear folks,

I have an ASP with fields bound to an Access database.

When I test the page by adding a duplicate primary key and clicking Save button, I get :

Error Type:
Microsoft JET Database Engine (0x80004005)
The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship. Change the data in the field or fields that contain duplicate data, remove the index, or redefine the index to permit duplicate entries and try again.
/hardware/_ScriptLibrary/Recordset.ASP, line 311

How do I display a friendly message in lieu of the above and then return the user to the page with focus on the primary field's textbox?

Please help.

Mark
mark@shillong.meg.nic.in

 
maybe somebody in the ASP forum would be better able to help ?
 
yup, this is an ASP question, u can use the error object...

Known is handfull, Unknown is worldfull
 
Actually, I'm new to JS and I was looking for a client-side _onbeforeserverevent handler for the Save button. Can't such a thing be done in JS?

Mark
 
Nope, those error messages are created as plain html files by your web server (eg IIS or Apache). It would be easier to modify said plain html pages to have the friendly error message built in, than to modify them to include script that did exactly the same thing.

Have a look at: and perhaps:
and to a lesser extend:
Posting code? Wrap it with code tags: [ignore]
Code:
[/ignore][code]CodeHere
[ignore][/code][/ignore].
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top