PDA

View Full Version : Alert Error Popups


Our House
11-24-2007, 07:44 AM
Hi All,

Several of my forms use error-checking. At the moment, I use the following PHP function to create Javascript Alert errors and call it whenever information is filled in incorrectly:


function AlertError($message)
{
print("<script language='Javascript'>alert('" . $message . "')</script>");
}



The above function gets executed with 'submit' buttons and works like it should when an error is detected. However, it displays the alert error over a new (blank white) page and then reverts back to the old page after the user hits 'OK'. It's pretty ugly-looking.

What I want it to do is the same thing that vB Alert Errors do (see screenshot below).

http://img256.imageshack.us/img256/505/alertmessagels6.png

I deal entirely with PHP and HTML when working on my forum. I know absolutely nothing about AJAX or Javascript.

What is the easiest way to make this Alert function pop up over the existing page without actually submitting the form?

Thank You,
OH

ZomgStuff
11-24-2007, 01:24 PM
Isn't this a default feature of vBulletin?

Our House
11-27-2007, 08:44 AM
Isn't this a default feature of vBulletin?It is, but only for vBulletin's error messages, not my own.

Anyone have any suggestions?