[development] Pre-loading drupal.settings

Jeff Greenberg jeff at ayendesigns.com
Fri Mar 26 21:48:21 UTC 2010


I have a page with a form provided by a module, and the submit function 
in the module does a form redirect at the end.


The page redirected to has a jsquery page ready function that opens a 
window based on a drupal.settings value.


I also have a php snippet that checks a $_SESSION variable for a value, 
and if it's present, does the drupal_add_js call to populate the drupal 
settings value.


What I seem unable to do is take the $_SESSION value (set in the submit 
function of the form) and place the php snippet so that the page that is 
loaded has that value in place when the page ready function is called.


At first, I had the code in the form submit function. That actually 
caused the window to pop open on the form page. I moved the code to the 
head of the page template for the page that -should- pop open the 
window. But it doesn't work...the window is opened on the page loaded 
AFTER the page that was redirected to.


So:

[Form page]  -> get info -> submit function -> load session var -> 
redirect to page A

[Page A] -> template does drupal_add_js to create drupal.settings value 
-> page ready -> check settings and open a window with the file name in 
the settings value


That's what I have...where -should- I have the drupal_add_js?


Jeff



More information about the development mailing list