On Fri, Jul 18, 2008 at 01:14:08PM -0700, Igor Vaynberg wrote:
> override oncomponenttag() of the form and call super followed by
> tag.put("action", "whateverurl");
Thanks for the pointer, Igor!
For the benefit of archive searchers, the onComponentTag() solution
required that I add a wicket:id to my form--even though form
submission is not handled by Wicket. I also needed to override
onComponentTagBody() to prevent the Form rendering from adding Wicket
hidden fields to my form.
Here is a code snippet to illustrate:
public class SearchPanel extends Panel {
public SearchPanel(String id) {
super(id);
add(new Form("searchForm") {
protected void onComponentTag(ComponentTag tag) {
// prefix the form "action" attribute with a relative path
prefix
tag.put(
"action",
RequestCycle.get().getRequest().getRelativePathPrefixToContextRoot()
+ tag.getAttributes().getString("action"));
}
// override the default to suppress the addition of Wicket hidden
form fields
protected void onComponentTagBody(final MarkupStream markupStream,
final ComponentTag openTag) {
renderComponentTagBody(markupStream, openTag);
}
});
}
}
--Brad
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]