});
}
public void demo4() {
// Create a submit link
final SubmitLink confirmationLink = new SubmitLink("confirmationLink");
Form form = new Form("demo4");
addControl(form);
FieldSet fieldSet = new FieldSet("fieldSet");
form.add(fieldSet);
fieldSet.add(new TextField("name"));
// Add the submit link to the FieldSet
fieldSet.add(confirmationLink);
// Set custom JavaScript for the onclick event. The confirmSubmit function
// is defined in the page template -> submit-link-demo.htm
String clickEvent = "return confirmSubmit(this, '" + form.getId() + "', 'Are you sure?');";
confirmationLink.setOnClick(clickEvent);
// The Parametrized SubmitLink action listener
confirmationLink.setActionListener(new ActionListener() {
public boolean onAction(Control source) {
String demo4Msg = confirmationLink.getName() + ".onAction invoked at "
+ (new Date());
addModel("demo4Msg", demo4Msg);
return true;
}
});