Hello,

We have a problem when we use a window with few tabs and mandatory fields.
We have coded a specific class to show our problem (see “WindowMandatoryError”).
In this example, we have two tabs. We have a mandatory field in the second tab. The value of this field is already assigned with a “setvalue”.
When we open the “WindowMandatoryError” and click on “submit” we can see that the “home” field is not valid even if the value is already assigned.
If we click on the second tab and then on “submit” at this time the “home” field is valid.
This problem comes from the “render” property of the field. When we are on the first tab, the render property is false and in this case the getRowValue returns “” (empty string).

public String getRawValue() {
String v = rendered ? getInputEl().getValue() : "";
if (v == null || v.equals(emptyText)) {
return "";
}
return v;
}

How can we resolve this problem ?
Thank you for your response.



package com.aems.crm.main.client;

import com.extjs.gxt.ui.client.GXT;
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.aria.FocusManager;
import com.extjs.gxt.ui.client.event.BaseEvent;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.widget.Dialog;
import com.extjs.gxt.ui.client.widget.TabItem;
import com.extjs.gxt.ui.client.widget.TabPanel;
import com.extjs.gxt.ui.client.widget.VerticalPanel;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.form.FormPanel;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.layout.FormData;
import com.extjs.gxt.ui.client.widget.layout.FormLayout;

public class WindowMandatoryError extends Dialog {

final private VerticalPanel vp;


public WindowMandatoryError() {
setLayout(new BorderLayout());
setWidth(400);
setHeight(300);
vp = new VerticalPanel();
vp.setSpacing(10);
createTabForm();
add(vp);
}

private void createTabForm() {
final FormData formData = new FormData("100%");
final FormPanel panel = new FormPanel();
panel.setBodyStyleName("example-bg");
panel.setPadding(0);
panel.setFrame(false);
panel.setHeaderVisible(false);
panel.setBodyBorder(false);
panel.setButtonAlign(HorizontalAlignment.CENTER);
panel.setLayout(new FitLayout());

final TabPanel tabs = new TabPanel();

final TabItem personal = new TabItem();
personal.setStyleAttribute("padding", "10px");
personal.setText("Personal Details");
personal.setLayout(new FormLayout());

TextField<String> name = new TextField<String>();
name.setFieldLabel("First Name");
name.setValue("Darrell");
personal.add(name, formData);

TextField<String> last = new TextField<String>();
last.setFieldLabel("Last Name");
last.setValue("Meyer");
personal.add(last, formData);

TextField<String> company = new TextField<String>();
company.setFieldLabel("Company");
personal.add(company, formData);

TextField<String> email = new TextField<String>();
email.setFieldLabel("Email");
personal.add(email, formData);

final TextField<String> valid = new TextField<String>();
valid.setFieldLabel("Info validation");
valid.setValue("");
personal.add(valid, formData);

tabs.add(personal);

final TabItem numbers = new TabItem();
numbers.setStyleAttribute("padding", "10px");
numbers.setText("Phone Numbers");
numbers.setLayout(new FormLayout());

final TextField<String> home = new TextField<String>();
home.setFieldLabel("Home");
home.setValue("800-555-1212");
home.setAllowBlank(false);
numbers.add(home, formData);

TextField<String> business = new TextField<String>();
business.setFieldLabel("Business");
numbers.add(business, formData);

TextField<String> mobile = new TextField<String>();
mobile.setFieldLabel("Mobile");
numbers.add(mobile, formData);

TextField<String> fax = new TextField<String>();
fax.setFieldLabel("Fax");
numbers.add(fax, formData);

tabs.add(numbers);

panel.add(tabs);
panel.addButton(new Button("Submit", new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
if (home.isValid()) {
valid.setValue("Valide");
}
else {
valid.setValue("Non Valide");
}
}
}));


panel.addButton(new Button("Cancel"));

panel.setSize(340, 200);

if (GXT.isFocusManagerEnabled()) {
name.getFocusSupport().setPreviousId(panel.getButtonBar().getId());
home.getFocusSupport().setPreviousId(panel.getButtonBar().getId());

panel.getButtonBar().getFocusSupport().addListener(FocusManager.TabNext, new Listener<BaseEvent>() {
public void handleEvent(BaseEvent be) {
tabs.getItem(tabs.getSelectedItem() == tabs.getItem(0) ? 0 : 1).getItem(0).focus();
be.setCancelled(true);
}
});
panel.getButtonBar().getFocusSupport().addListener(FocusManager.TabPrevious, new Listener<BaseEvent>() {
public void handleEvent(BaseEvent be) {
TabItem item = tabs.getItem(tabs.getSelectedItem() == tabs.getItem(0) ? 0 : 1);
item.getItem(item.getItemCount() - 1).focus();
be.setCancelled(true);
}
});

}

vp.add(panel);
}


}