Issue 52: Inline javascript not rendering
Status:  Fixed
Owner: ----
Closed:  Jan 2009
Reported by aaron...@gmail.com, Jul 22, 2008
I'm using nyromodal to render a form in a popup window. Inline javascript
code on the form does not process when it's inside the modal window. Is
this a bug or is there some way to enable this?
Jul 22, 2008
Project Member #1 william....@gmail.com
if its in a pop up window that is an Iframe, it should render because it is 
essentially a window of its own with its own DOM.  However, if its called and loaded 
via ajax thats a little more tricky.  It becomes part of the bigger pages DOM.  So 
you must either put that validation on the "parent page" or I found it could be 
called if you wrap your functions as follows.  It will then be processed and 
attached to the form elements.  CAREFUL, this will also attach the funcitonality to 
elements with those IDs in the parent window because they are in the same DOM.  I 
hope this helps.  This code should work stand alone and when loaded in the modal.

run nyromodal.html and click the 'submit_me' button.  it loads the reciever.html 
page as ajax but can still run js that was loaded with it.  view reciever.html for 
how it was done.
formexample.zip
156 KB   Download
Jul 22, 2008
#2 aaron...@gmail.com
Thanks for the code... turns out it wasn't a problem with the javascript but
something with the jquery ui library. I couldn't get an inline datepicker to render
even though other javascript functions worked. It may be the same issue as the post
about jquery-ui tabs... weird.
Aug 27, 2008
Project Member #3 nyro...@gmail.com
I spent many times to try to able the inline javascript code in the modal.
aaronchi, could you send your html and js file to see what's happen please ?
Oct 31, 2008
#4 nicolas.kapfer@gmail.com
Hi, I experience the same problem with the plugin "datePicker"
(http://kelvinluck.com/assets/jquery/datePicker/v2/demo/). It's just not working when
I put my php page in a nyroModal window. 
I attach all the code in one file. 
The process is like that:
I open index.php > click on the link "datePicker in a nyroModal" > it should open the
demo (http://kelvinluck.com/assets/jquery/datePicker/v2/demo/datePickerStartEnd.html)
that works perfectly out of a nyromodal.

I hope I was clear enough!
Thanks.
codeSample.html
5.3 KB   View   Download
Jan 26, 2009
Project Member #5 nyro...@gmail.com
In the next release, you'll be able to indicate if you want a script to be executed
once the modal is shown (just before the endShowContent callback) by putting
rev="shown" on your script tag.

On the other you already have the ability to force the download of a js file by using
rel="forceLoad".

Here is how you'll do it with the next version:
1) on your opened file, put the rel="forceLoad" on the datePicker js.
2) on the script tag used to instanciate the datepicker (something like
$('#example').datepicker();) you'll put the rev="shown" attribute
3) you'll probably need to set the z-index of the datepicker to something higher to 105.

Attached is the solution which will work with the next version and using the jQuery
UI datepicker.

NB : the next version will be compatible with jQuery 1.3
calendar.zip
14.7 KB   Download
Status: Fixed