Error message

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
shile
Forum Newbie
Posts: 15
Joined: Thu Oct 04, 2012 6:45 pm

Error message

Post by shile »

i made a form that has unique values,and when i enter values that are already in database and click submit button an error message(500) pops out because there are already values with the same data,i want it to be that way...but my question is,can i somehow override the output of this error,i want to show it only to the user as an usual alert box?
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Error message

Post by pickle »

It depends entirely on how your code is set up. If your database code automatically echo()s the error message to the screen, then there's not much you can do. However, if it just records the error in a function return value, or some other variable that you then output later in your code (ie: in your template), then you should be able to modify your template to output the error in an alert() box rather than HTML to the page
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

Re: Error message

Post by twinedev »

Have the script query the database for records that match submitted data, if so, give them you custom message.

A server error is never an acceptable response to the end user.
shile
Forum Newbie
Posts: 15
Joined: Thu Oct 04, 2012 6:45 pm

Re: Error message

Post by shile »

twinedev wrote:Have the script query the database for records that match submitted data, if so, give them you custom message.

A server error is never an acceptable response to the end user.
it is a tricky business with this code because its a joomla component that i am recoding...i didnt want to show the server error to the user,i wanted to change the output and then show it...
Post Reply