PDA

View Full Version : [2.0] CheckBoxGroup validation error display



VadimV1144
16 Jul 2009, 10:49 PM
Hi, I am having the following issue with the CheckBoxGroup.
If there is a validation error on a CheckBoxGroup, there are two issues:

a) The first time the error appears, the error icon (red circle with exclаmation point) first shows up right under the checkbox and then jumps to its correct position to the right of the CheckBoxGroup (MessageTarget is set to "side"). After the error appears at least once the issue disappears until the next page reload.

b) Neither the CheckBoxGroup nor the CheckBox itself is marked as having an error. For example the TextBox is surrounded by a red border and the text within the box is underlined.

- GXT 2.0
- Both (Host and web mode)
- IE 7.0, FireFox 3.5
- Windows XP x64
- Simple test function


private void buttonGroupTest(){

//Group Validator
class AtLeastOneCheckBoxGroupValidator implements Validator {
private String errorMsg = "Error.";
public AtLeastOneCheckBoxGroupValidator(final String errorMsg){
super();
if(errorMsg != null)
this.errorMsg = errorMsg;
}

public String validate(Field<?> field, String value) {
CheckBoxGroup group = (CheckBoxGroup) field;
CheckBox cb = group.getValue();
if(cb == null )
return errorMsg;
return null;
}
}

//Create form with a CheckBoxGroup and a single Checkbox
final FormPanel fp = new FormPanel();
fp.setFieldWidth(300);
fp.setFrame(true);

CheckBoxGroup group = new CheckBoxGroup();
group.setName("group");
group.setLabelSeparator("");
group.setValidator(new AtLeastOneCheckBoxGroupValidator("Needs to be checked."));

CheckBox checkBox = new CheckBox();
checkBox.setName("Checkbox");
checkBox.setBoxLabel("Test CheckBox");

TextField<String> txt = new TextField<String>();
txt.setName("text");
txt.setFieldLabel("Text Test");
txt.setAllowBlank(false);

fp.add(txt);
group.add(checkBox);
fp.add(group);

// Button that initiates the validation event
com.extjs.gxt.ui.client.widget.button.Button validate = new com.extjs.gxt.ui.client.widget.button.Button("Validate");
validate.addSelectionListener(new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent ce) {
fp.isValid();
}
});

//Viewport
Viewport viewport = new Viewport();
viewport.add(fp);
viewport.add(validate);
RootPanel.get().add(viewport);
}

sven
17 Jul 2009, 2:39 AM
This is not a bug. Moving this to the help forum.

1) This is already fixed in SVN.

2) is just not implemented. You can add this feature.

VadimV1144
17 Jul 2009, 5:24 AM
thanks, btw how do I get access to the SVN - is it only for paying clients?

sven
17 Jul 2009, 5:27 AM
SVN access is available for support subscriptions:

http://www.extjs.com/store/gxt/#support-table