the javascript contributions are filtered by the id given in the second parameter, in your case: "pdcJS". since your ids are constant only the first contribution makes it.
using UUID.random() will fix it it as far as header contributions go. -igor On Tue, Jun 29, 2010 at 7:45 AM, Muro Copenhagen <[email protected]> wrote: > Hi, > > I have a small behavior that prevents doubleclick on buttons. > > It is added to Modal popups on a page. The problem i have is that if the > Modal window appears twice on a page, > the javascript variable value of the first popup is used. > > This is because i am using: response.renderJavascript(...); which is only > rendered once. > > How can i force rerendering of the javascript, or is there any other way of > achieving defaulting the javascript variable, > for each modal window on my page? > > > This is how it my behavior looks: > > public class PreventDoubleClickBehavior extends AbstractBehavior { > > private String submitScript = "if(submitting) {this.disabled = true; > return false;} else {submitting = true;}"; > > �...@override > public void renderHead(IHeaderResponse response) { > response.renderJavascript("var submitting = false;", "pdcJS"); > } > > �...@override > public void onComponentTag(Component component, ComponentTag tag) { > IValueMap valueMap = tag.getAttributes(); > CharSequence oldOnclickFunctions = > valueMap.getCharSequence("onclick"); > if (oldOnclickFunctions == null) { > oldOnclickFunctions = ""; > } > tag.put("onclick", submitScript + oldOnclickFunctions); > } > } > > Thanks in advance... > > Muro > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
