Hi Evan,

try this

private static final ResourceReference YOURJS = new 
JavaScriptResourceReference( YourClassWhereJavascriptReside.js.class, 
"YourModifiedJavascript.js");

@Override
public void renderHead(IHeaderResponse response)
{
        response.render(JavaScriptHeaderItem.forReference(YOURJS));
        response.render(OnDomReadyHeaderItem.forScript("new MultiSelector('" + 
getInputName() +
                        "', document.getElementById('" + 
container.getMarkupId() + "'), " + max + ",'" +
                        getString("org.apache.wicket.mfu.delete") + 
"').addElement(document.getElementById('" +
                        upload.getMarkupId() + "'));"));
}



François Meillet
Formation Wicket - Développement Wicket





Le 14 févr. 2013 à 00:39, Evan Sable <e...@novelution.com> a écrit :

> Hi,
> 
> I'm working on a project that's on wicket 1.4.  It's using
> the MultiFileUploadField class.  I see in the code for that class that in
> renderHead, it calls:
> response.renderJavascriptReference(JS);
> and earlier it defines:
> private static final ResourceReference JS = new JavascriptResourceReference(
> MultiFileUploadField.class, "MultiFileUploadField.js");
> 
> But, I'd like to make a minor modification to the actual javascript in
> MultiFileUploadField.js.  Specifically, I want to modify that code to
> remove the "c:/fakepath" prefix that appears in the box with the list of
> selected files below the field (in chrome and safari - not a problem in
> firefox and ie).  If I could just over-ride the javascript contents of that
> file, it would be an easy fix.  But, more generally, I'd like to know not
> just for this specific issue, is there a "wicket way" to override the
> packaged javascript resource that comes with a component?  Perhaps is there
> a simple way to extend the MultiFileUploadField class with my own class,
> and somehow keep the rest of the code as is, but specify an alternate
> resource?  It's private in that class, so I don't see how I'd do this, but
> maybe I'm missing something obvious.  Or maybe is there some way to keep
> using the same class but to tell the application that I want to replace the
> corresponding javascript file with my own?  Or is there some other approach
> I should be taking when this type of issue comes up?
> 
> Thanks very much for any advice,
> -Evan

Reply via email to