HTML Code
<form wicket:id="form">
<input type="submit" wicket:id="submitBtn" value="Submit" id="button"/>
</form>
Wicket Code
//Without Ajax
Form<?> form = new Form<CreditCard>("form",// your compound property model);
SubmitLink submitLink = new SubmitLink("submitBtn");
submitLink.add(AttributeModifier.replace("onclick", "alert('welcome withou ajax')"));
addCardForm.add((submitLink));
add(form);
//With Ajax
form .add(new AjaxSubmitLink(" submitBtn ") {
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
target.appendJavaScript("alert('welocme with ajax');");
}
No comments:
Post a Comment