Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

Upgrading from SmartGWT 4.1p to 5.0p TextItem/setLength/setRequired problem

$
0
0
Hi,

When a first field has as setLength() attribute and setRequired(),
setRequired() on the second field has no effect.


Example: #form_dep_conditionally (Change)

Code:

public class FormConditionallyRequiredSample extends ShowcasePanel {
    private static final String DESCRIPTION = "Select \"No\" and click the \"Validate\" button - the reason field becomes required.";

    public static class Factory implements PanelFactory {
        private String id;

        public ShowcasePanel create() {
            FormConditionallyRequiredSample panel = new FormConditionallyRequiredSample();
            id = panel.getID();
            return panel;
        }

        public String getID() {
            return id;
        }

        public String getDescription() {
            return DESCRIPTION;
        }
    }

    public Canvas getViewPanel() {

        final DynamicForm form = new DynamicForm();
        form.setWidth(250);
        form.setTitleOrientation(TitleOrientation.TOP);

        TextItem test = new TextItem();
        test.setName("test");
        test.setTitle("test");
        test.setLength(3);
test.setRequired(true);

        TextItem textItem = new TextItem();
        textItem.setName("reason");
        textItem.setTitle("Reason");
textItem.setRequired(true);

        ButtonItem buttonItem = new ButtonItem("validate", "Validate");
        buttonItem.addClickHandler(new com.smartgwt.client.widgets.form.fields.events.ClickHandler() {
            public void onClick(ClickEvent event) {
                form.validate();
            }
        });

        form.setFields(test, textItem, buttonItem);
        return form;
    }

    public String getIntro() {
        return DESCRIPTION;
    }

}

If I delete the setLength() on the first field, setRequired() of the
second field works now ...



Gwt 2.7.0
http://www.smartclient.com/builds/SmartGWT/5.0p/LGPL/2015-02-23
Firefox 35.0.1

Viewing all articles
Browse latest Browse all 4756

Trending Articles