Using Existing div as the div of the modal window

I'm trying to use the Control.Modal library to create a modal window. The problem I have is that I'm trying to use an existing hidden div as the div of the actual modal windows, not just the contents of the modal window. The existing hidden div contains a form which has JavaScript validations using the id of the different form elements. I know I can pass in myDiv.innerHTML as the contents option to load the contents, but then I have two forms with the same name and form elements with conflicting ids (which screws up validation and other things).

Is there a way to have Control.Modal use an existing div as the modal window? In other words, I'm basically just looking to use Control.Modal to fade the page, center an existing div, and then show it. Am I better off just doing it myself, or can Control.Modal do this?

Posted June 8th, 2007 at 10:20am by Temuin_12

What about storing the innerHTML of your div in a variable, then emptying the div, and passing the variable to the modal. That way you've only got one copy of that code in your DOM.

If required, you could then grab the content back and put it in your div when the modal is closed.

Posted June 11th, 2007 at 4:40am by bbodien

Login or Register to Post