在负载执行一个JavaScript Modalbox JavaScript的code(和内部)

在负载执行一个JavaScript Modalbox JavaScript的code(和内部)

问题描述:

什么,我究竟要做的是让我的script.aculo.us Autocompleter工作,为我的形式时,它是一个Modalbox对象中加载。

What i'm exactly trying to do is make my script.aculo.us Autocompleter work for my form when it is loaded inside a Modalbox object.

当然,我已经尽我Autocompleter装的形式作为独立的时候,它工作得如预期。作为参考,这是我的JS code加载功能:

Of course, i've tried my Autocompleter when loading the form as standalone and it works just as expected. For reference, here is my JS code loading the feature:

Event.observe(window, 'load', function() { 
new Ajax.Autocompleter("gl_name", "autocomplete_choices", "<? echo WEB_ROOT . $page_name; ?>?action=ajax_autocomplete", {
    paramName: "value",
    minChars: 2,
    indicator: 'indicator1',
    afterUpdateElement: getSelectionIdGL
    });
});

然后,我有我的Autocompleter股利和指示器,其出现在我的HTML的主体的结束:

Then I have my Autocompleter div and indicator which appear at the end of my html's body:

<span id="indicator1" style="display: none">
    <img src="/images/spinner.gif" alt="Working..." />
</span>
<div id="autocomplete_choices" class="autocomplete"></div>

我也叫Modalbox()与evalScripts:真正的

I also called the Modalbox() with evalScripts: true.

所以,我基本上知道我的问题是:我想要创建我autocompleters形式的负载,但窗口对象已经被加载时,脚本编写,因为它基本上是同一窗口调用页面

So I basically know where my problem is: I want my autocompleters to be created a the load of the form, but the "window" object is already loaded when the script is written since it's basically the same window as the calling page.

这是说,我真的没有看到哪个事件可能永远不会真正启动。我甚至不知道这是否是完全可能的,但我当然希望它是。

That said, I honestly don't see to which event it could ever be actually triggered. I don't even know if it's actually possible, but I certainly hope it is.

所以..这就是它。我不知道还有什么要补充。如果您需要在我的问题的任何澄清不要犹豫了。

So.. that's about it. I don't know what else to add. Don't hesitate if you need any clarifications on my issue.

您知道modalbox的的回调函数的? 您可以使用负荷一个创建autocompleter。

Are you aware of modalbox's callback functions? You can use the afterLoad one to create the autocompleter.