Ticket #2168 (closed defect: worksforme)

Opened 3 months ago

Last modified 4 weeks ago

Form.discard() should clear the error message from the form

Reported by: Joonas Lehtinen Owned by: ticketmaster
Priority: minor Milestone: User Interface Library 5.3.0 RC
Component: gwt-adapter-server Version: 5.2.10
Keywords: Cc:
Known Issue description:
Hours estimate: Deadline (dd.mm.yyyy):
Known Issue version (since): Known Issue title:
Hours done: Depends to:
Affects documentation: no
Known Issue workaround:
Affects release notes: no Contract:

Description

Now the error messahe is show in the form only after commit(). It would be intuitive to clear the error message when doing discard().

Change History

Changed 7 weeks ago by Joonas Lehtinen

  • status changed from new to closed
  • resolution set to invalid

Testcase missing.

Changed 4 weeks ago by Joonas Lehtinen

  • status changed from closed to reopened
  • resolution deleted

Test-case:

import com.itmill.toolkit.Application;
import com.itmill.toolkit.data.Item;
import com.itmill.toolkit.data.util.BeanItem;
import com.itmill.toolkit.data.validator.StringLengthValidator;
import com.itmill.toolkit.ui.Button;
import com.itmill.toolkit.ui.Form;
import com.itmill.toolkit.ui.HorizontalLayout;
import com.itmill.toolkit.ui.Window;
import com.itmill.toolkit.ui.Button.ClickEvent;

public class TestApp extends Application {

	public void init() {
		final Window main = new Window("Testing....");
		setMainWindow(main);

		final Name name = new Name();
		Form f = new Form();
		Item i = new BeanItem(name);

		f.setCaption("Test form");
		f.setItemDataSource(i);
		f.setWriteThrough(false);
		f.setReadThrough(false);

		HorizontalLayout buttons = new HorizontalLayout();
		buttons.addComponent(new Button("Commit", f, "commit"));
		buttons.addComponent(new Button("Discard", f, "discard"));
		f.setFooter(buttons);

		f.getField("firstName").addValidator(
				new StringLengthValidator("Must be at least 3 characters", 3,
						1000, false));

		main.addComponent(f);

		main.addComponent(new Button("Show datasource contents",
				new Button.ClickListener() {

					public void buttonClick(ClickEvent event) {
						main.showNotification(name.firstName + "<br/>"
								+ name.lastName);
					}
				}));
	}

	public class Name {
		String firstName="";
		String lastName="";

		public String getFirstName() {
			return firstName;
		}

		public void setFirstName(String firstName) {
			this.firstName = firstName;
		}

		public String getLastName() {
			return lastName;
		}

		public void setLastName(String lastName) {
			this.lastName = lastName;
		}

	}
}

Changed 4 weeks ago by Joonas Lehtinen

  • status changed from reopened to closed
  • resolution set to worksforme

Could not reproduce the issue.

Note: See TracTickets for help on using tickets.