This is unfortunately not supported. The Form container supports one flag per
field (where fields are defined by the form's sections). Form has no way of
knowing that you have multiple text inputs inside the box pane, so it can't
attach a flag to those text inputs. It can only show a flag for the fields it
knows about.
On Mar 26, 2010, at 6:02 PM, Shahzad Bhatti wrote:
> 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