views:

1587

answers:

4

Hi - I've been using jquery on and off for the last 6 months.

I have a form where I want to replace 20 different javascript alert(""); statements with jQuery Modal Dialog boxes.

I don't want to create a separate dialog div section for each different message.

Is there a way with base jquery-ui to create a reusable modal dialog box where I can pass in the message title and message text?

Let me know if you have any ideas?

Derek

+3  A: 

There are a lot of plugins that you can find for jQuery for dialog boxs.

I've used the facebox plugin in the past.

Basic usage could be as simple as:

jQuery.facebox('something cool')
Steve Kemp
I voted this as the answer because of it's simplicity. All answers were good..
Derek
+1  A: 

I would recommend jQuery's Growl plugin. http://plugins.jquery.com/project/Growl

The benefit to using Growl is that it has some really nice built in functionality, notably the optional ability to have an auto remove function.

It is the non-modal-modal.

What I mean by that is that it does not require the user to interact with it before they can return to interacting with the site, thus maintaining the workflow of the website.

superUntitled
+1  A: 

I heavily recommend Impromptu. It's well documented, has good examples, and basically a drop-in replacement for javascript Alert and Input, however it is very extendable and has a ton of options and extra features.

Kris Erickson
A: 

I used to use Facebox quite a bit but I'm phasing it out in favour of the Dialog box which is part of jQuery's UI collection:

http://docs.jquery.com/UI/Dialog

You mentioned core jquery-ui, does this not do the trick?

Geir Freysson