listview 中的 wicket 验证文本字段看不到错误消息 [英] wicket validate textfield inside listview can't see error message
本文介绍了listview 中的 wicket 验证文本字段看不到错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在列表视图中有一个列表视图.我在嵌套列表视图中有一个文本字段.
I have a listview inside a listview. I have a textfield inside the nested listview.
new ListView<ConfigStructure>("subListView", propertyList) {
@Override
protected void populateItem(ListItem<ConfigStructure> item) {
ConfigStructure config = item.getModelObject();
final TextField<String> configValue = new TextField<>("configValue",new PropertyModel(config, "value"));
configValue.setRequired(true);
configValue.add(new CustomConfigValidator(config));
item.add(configValue);
}
});
我在页面上有一个反馈面板
I have a feedback panel on the page
add(new FeedbackPanel("feedback"));
但我没有看到任何错误出现.如果我输入的值未通过验证,则不会提交这些值.但我也没有看到错误消息.
But i don't see any errors showing up. The values are not getting submitted if I enter a value that does not pass the validation. but i don't see the error messages either.
在我的 CustomConfigValidator 中,我有以下内容
Inside my CustomConfigValidator, I have the following
@Override
public void validate(IValidatable<String> validatable) {
//get input from attached component
final String field = validatable.getValue();
if(!checkIfValid){
error(validatable, "Validation failed for " + config.getLabel() + " with value " + field + ",value should satisfy " + validateString);
}
推荐答案
Reader ListView 的 javadoc:
Reader ListView's javadoc:
<strong>WARNING:</strong> though you can nest ListViews within Forms, you HAVE to set the setReuseItems property to true in order to have validation work properly. By default, ...
这篇关于listview 中的 wicket 验证文本字段看不到错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文