The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Ajax to show partial if

Hello Folks,
I have a simple model, object that has a 2 attributes: name and active and I need to have only 1 active object.
In the form to add new objects I have a text-field for the name and a select for active (yes/no). The issue is that if the user selects yes I need to check if there is an other active object (and this is not a problem) and if there is I would like, before saving the new object and changing the active value of the former active object, ask a confirmation.

I was thinking to use Ajax to show a partial to ask for confirmation. But here I'm lost, I tried several "experiments" but they don't work.

I don't have a checkbox but a select (this is not a issue)
Anyway I want that the user can change the active object but if there is a object already active when he tries to add an active object the application notifies that with something like "object1 is active, do you want to change active object ???"