dont use an ajax button, they do not respect the target attribute.
-igor
On Sat, Jun 25, 2011 at 6:36 AM, Gregor Kaczor gkac...@gmx.de wrote:
Hi!
I have a problem with opening a new tab via a form.
I am using Wicket 1.4.17 on Ubuntu 11.04 with java 1.6.0_24-b07 and Tomcat
7.0.12
On a page I have a Download Button in a form with a Link to a file or an
image.
After clicking on that button a new Tab should be opened with that link.
Unfortunatelly the file opens in the working tab. Adding target=_blank to
the form or the submit button does not change that behaviour.
Just for fun i removed the wicket-ajax.js from the html file and opening a
new tab via a form WORKED!
Here is my code. What do I have to do to open a new tab when the
AjaxFallbackButton is clicked?
code
FormVoid form = new FormVoid(downloadForm){
@Override
protected void onComponentTag(ComponentTag tag) {
// TODO Auto-generated method stub
super.onComponentTag(tag);
tag.put(target,_blank);
}
};
final ModelString buttonLabelModel = new ModelString(DOWNLOAD);
final Label label = new Label(downloadButtonLabel,
buttonLabelModel);
label.setOutputMarkupId(true);
label.setOutputMarkupPlaceholderTag(true);
final AjaxFallbackButton a = new AjaxFallbackButton(downloadButton,
form) {
private static final long serialVersionUID =
5109029782741176146L;
@Override
protected void onSubmit(AjaxRequestTarget target, Form? form) {
String url = solrDocument.getFieldValue(idadr).toString();
System.out.println(queryResultLine.toString() + \tDL: +
url
+ \tPosition: + positionCounter);
getRequestCycle().setRequestTarget(
new RedirectRequestTarget(url));
}
};
a.add(label);
form.add(a);
/code
code
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
...
form
style=display: inline;
wicket:id=downloadForm
target=_blank
button target=_blank wicket:id=downloadButtonspan
wicket:id=downloadButtonLabel
//button
/form
...
/code
I am aware of the fact, that i am adding target=_blank twice over the
onComponent methid and in the html. I tested combinations without results.
Kind Regards
Greg
-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org
-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org