I am trying to build a form with multiple fields and would like to show all
errors when form validation fails. From looking at samples, it looks like we
can only have one Form.Flag per box pane such as following snippet from
Forms.java
submitButton.getButtonPressListeners().add(new ButtonPressListener() {
@Override
public void buttonPressed(Button button) {
String lastName = lastNameTextInput.getText();
String firstName = firstNameTextInput.getText();
Form.Flag flag = null;
if (lastName.length() == 0
|| firstName.length() == 0) {
flag = new Form.Flag(MessageType.ERROR, "Name is
required.");
}
Form.setFlag(nameBoxPane, flag);
if (flag == null) {
errorLabel.setText(null);
Prompt.prompt("Pretending to submit...", window);
} else {
errorLabel.setText("Some required information is missing.");
}
}
});
Is it possible to show error messages next to each field when form validation
fails. I would appreciate for any examples. Thanks.
______________________________________________
See http://www.peak6.com/email_disclaimer.php
for terms and conditions related to this email