I am using Wicket-1.3.0 Version.
Following are the code Snippet

//Code Snippet for RadioChoice//
RadioGroup  sexField = new RadioGroup("sex", new Model());
            sexField.add(new Radio("male", new Model("Male")));
            sexField.add(new Radio("female", new Model("Female")));
            sexField.setOutputMarkupId(true);
            sexField.setRequired(true);
            add(sexField);
            final FeedbackLabel sexFeedbackLabel = new
FeedbackLabel("sexFeedback", sexField);
            sexFeedbackLabel.setOutputMarkupId(true);
            add(sexFeedbackLabel);

//Code Snippet for AutoCompleteTextField//
AutoCompleteTextField cityField = new AutoCompleteTextField("city", new
Model()) {
                @Override
                protected Iterator getChoices(String input) {
                    if (Strings.isEmpty(input)) {
                        return Collections.EMPTY_LIST.iterator();
                    }
                    List choices = new ArrayList();
                    List name = reader.loadFile("cities.txt");//cities.txt
contains cities name...
                    Iterator itr = name.iterator();
                    while (itr.hasNext()) {
                        String nameIs = (String) itr.next();
                        if
(nameIs.toUpperCase().startsWith(input.toUpperCase())) {
                            choices.add(nameIs);
                            if (choices.size() == 10) {
                                break;
                            }
                        }
                    }
                    return choices.iterator();
                }
            };
            cityField.setOutputMarkupId(true);
            cityField.setRequired(true);
            cityField.add(new StringValidator.MaximumLengthValidator(25));
            final FeedbackLabel cityLabel = new
FeedbackLabel("cityFeedback", cityField);
            cityLabel.setOutputMarkupId(true);
            add(cityLabel);
            cityField.add(new ComponentVisualErrorBehavior("onblur",
cityLabel));
            add(cityField);
            Label citLabel = new Label("city.label", "City");
            add(citLabel);


Thank you
-- 
View this message in context: 
http://www.nabble.com/Form-Validations-tp22777684p22799307.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to