PDA

View Full Version : FORM PANEL & ERROR ICON ON SUBMIT



drenda81
7 Jul 2008, 11:58 PM
Hi,
when you have a form panel with some fields and you set some validation rules on them, with this sequence of step an error icon is show disproperly:

1-compile the form but invalidate a field (4 example leave it blank with the setAllowBlank(false) set on it)

2-press the submit button

3-is show an erro icon and a display message

4-compile the field without lost focus (with the keyboard) from the field

5-press submit button

In this manner the error icon is not hide also is the form is valid.
The bug is present in:
-Firefox 3
-Opera 9.51
-Safari 3.1.2

on Windows Xp

Thanks

darrellmeyer
8 Jul 2008, 5:35 AM
Please include test code in this format (http://extjs.com/forum/showthread.php?t=40289).

drenda81
8 Jul 2008, 11:28 AM
Here the code:
[CODE]
public class MainEntryPoint implements EntryPoint {

public void onModuleLoad() {
Viewport viewport = new Viewport();
viewport.setLayout(new BorderLayout());

ContentPanel centerPanel = new ContentPanel();
centerPanel.setBorders(false);
centerPanel.setHeaderVisible(false);
centerPanel.setLayout(new FitLayout());
centerPanel.setScrollMode(Scroll.AUTO);

BorderLayoutData data = new BorderLayoutData(LayoutRegion.CENTER);
data.setMargins(new Margins(5, 5, 5, 5));
viewport.add(centerPanel, data);
RootPanel.get().add(viewport);

LayoutContainer lc = new LayoutContainer();
FlowLayout layout = new FlowLayout(0);
lc.setLayout(layout);
lc.setLayoutOnChange(true);


centerPanel.add(lc);
centerPanel.layout();

//This code is for simultate some change of the panels
lc.removeAll();
lc.add(getContent());
centerPanel.removeAll();
centerPanel.add(lc);
centerPanel.layout();
}

private Widget getContent() {
LayoutContainer outer = new LayoutContainer();
FlowLayout layout = new FlowLayout();
outer.setScrollMode(Scroll.NONE);

outer.setLayout(layout);
outer.setLayoutOnChange(true);


final FormPanel panel = new FormPanel();
panel.setFrame(true);
panel.setHeaderVisible(true);
panel.setAnimCollapse(false);
panel.setIconStyle("icon-table");
panel.setHeading("Nuovo utente:");
panel.setFieldWidth(210);
panel.setLabelWidth(100);
panel.setButtonAlign(HorizontalAlignment.LEFT);
panel.setWidth(400);
panel.setStyleAttribute("padding", "10");

final TextField cognome = new TextField();
cognome.setFieldLabel("Cognome");
cognome.setName("cognome");
cognome.setEmptyText("Inserire il cognome");
cognome.setAllowBlank(false);
TextFieldMessages err = cognome.getMessages();
err.setBlankText("Il campo

drenda81
8 Jul 2008, 12:18 PM
I'm adding a new scenario: whit the same code of the previus post, if you make an rpc call when submit button is pressed the problem is visible also in Firefox 3 (and also in Safari and Opera, view previous post). So the portion of the code that change is:


@Override
public void componentSelected(ComponentEvent arg0) {

save.setEnabled(false);

if (panel.isValid()) {

MainEntryPoint.get().getService().searchUsername(((String) username.getValue()).trim(), new AsyncCallback() {

public void onFailure(Throwable e) {
save.setEnabled(true);
Info.display("Attenzione", " " + e.getMessage(), "");
}

public void onSuccess(Object arg0) {
save.setEnabled(true);
InfoConfig ic = new InfoConfig("Info", "Utente salvato correttamente");
ic.display = 5000;
Info.display(ic);
}
});



I don't know if the problem is bounded to the time that the rpc call request.

Thanks