Hi Ashish,
Do you use AJAX? Have you added the components to the
AjaxRequestTarget with target.addComponent() ?
If you do use AJAX, you have to override both onError and onSubmit on
the AjaxButton you use for submit. In both these methods you have to
add the relevant components to the AjaxRequestTarget, or else they
won't get updated.
Something like:
form.add(new AjaxButton("saveButton"){
protected void onSubmit(AjaxRequestTarget target, Form
form) {
target.addComponent(sexFeedbackLabel);
target.addComponent(cityLabel);
// If you change other components, add them to the
target as well.
}
@Override
protected void onError(AjaxRequestTarget target, Form
form) {
target.addComponent(sexFeedbackLabel);
target.addComponent(cityLabel);
}
});
It is possible that I guessed completely wrong about your problem :-)
If you like, I can update the demo project with a working AJAX sample.
By the way, the blog post and demo project is all based on Wicket
1.3.4, so it is possible that this will not work for previous versions.
Regards,
Daan
Op 31 mrt 2009, om 08:46 heeft Ashis het volgende geschreven:
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]