JQUERY: problem with modal window and auto populate select

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

JQUERY: problem with modal window and auto populate select

Post by yacahuma »

This one is driving me crazy. I have a form with 3 select drop down. You change the first one, the 2nd changes. Change the 2nd , the 3rd changes. Is all working great. Now I want that form, to be in a popup, so I just encapsulated everything in a div with display: none and use the facebook popup (http://defunkt.github.com/facebox/). THE PROBLEM: When using the popup, the selects dont do anything, they dont change anymore. Is there anything else I am supposed to do?
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: JQUERY: problem with modal window and auto populate sele

Post by Eran »

Seeing some code would be helpful..
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

Re: JQUERY: problem with modal window and auto populate sele

Post by yacahuma »

So additional information. I just put an alert on the function and is not getting called. So the question now is why jquery does not register the .change on a window that has style="display:none"??

Let me see if I can write a very simple file
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: JQUERY: problem with modal window and auto populate sele

Post by Eran »

From what you are saying, it sounds like you introduced a Javascript error. Use something like firebug or activate IE javascript errors reporting to debug it
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

Re: JQUERY: problem with modal window and auto populate sele

Post by yacahuma »

Here is the link http://docma.stccorp.net/problem.htm

Notice that when you simply change the select your get the alert, but when you open the window and execute the same thing, you dont.
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: JQUERY: problem with modal window and auto populate sele

Post by Eran »

There are several things wrong here -
The modal seems to cloning the entire div containing the select. However, it probably isn't cloning the events set on it as well. A side problem that happens, is that now you have multiple elements with the same id attribute - which is invalid HTML and will cause problems when trying to target those elements.
Also, the implementation of the modal window is very bad in my opinion - tons of useless markup (divs inside tables and so forth) and the whole cloning approach is bad. I'd suggest you use some other plugin or implement your own modal window (which is quite simple)
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

Re: JQUERY: problem with modal window and auto populate sele

Post by yacahuma »

you are right, I took out the modal window and just use a div and is working. If you know of any similar code to replace the facebox let me know.
Post Reply