ShengChe Hsiao
2018-11-27 08:29:15 UTC
Dears
I have a form with listview which dynamically add TextField in it, but when
i enter some text in other fields and click add button to add TextField in
listview, the form cleared and I don't want this, do you have any
suggestions?
redirecturis = new ListView<String>("rows",
serviceProviderModel.getRedirecturi()) {
@Override
protected void populateItem(ListItem<String> listItem) {
listItem.add(new RequiredTextField("redirecturi", listItem.getModel()));
}
};
AjaxSubmitLinkBlockUI btnAdd = new AjaxSubmitLinkBlockUI("btnAdd", spregform) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
super.onSubmit(target, form);
logger.info("Form Data Add uri : {}", serviceProviderModel.toString());
//serviceProviderModel.setRedirecturi(serviceProviderModel.getRedirecturi());
serviceProviderModel.getRedirecturi().add("");
//spregform.setDefaultModelObject(serviceProviderModel);
spregform.modelChanged();
target.add(spregform);
target.add(container);
//target.add(formUpdateIcon);
//target.add(container);
}
};
--------------------------------------------------------------------
----------------------------------->
To boldly go where no man has gone before.
--------------------------------------------------------------------
----------------------------------->
We do this not because it is easy. We do this because it is hard.
-----------------------------------------------------------------
-------------------------------------->
If I have seen further it is by standing on the shoulders of giants.
----------------------------------------------------------
--------------------------------------------->
***@gmail.com
--------------------------------------------------------------------------------------------->
I have a form with listview which dynamically add TextField in it, but when
i enter some text in other fields and click add button to add TextField in
listview, the form cleared and I don't want this, do you have any
suggestions?
redirecturis = new ListView<String>("rows",
serviceProviderModel.getRedirecturi()) {
@Override
protected void populateItem(ListItem<String> listItem) {
listItem.add(new RequiredTextField("redirecturi", listItem.getModel()));
}
};
AjaxSubmitLinkBlockUI btnAdd = new AjaxSubmitLinkBlockUI("btnAdd", spregform) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
super.onSubmit(target, form);
logger.info("Form Data Add uri : {}", serviceProviderModel.toString());
//serviceProviderModel.setRedirecturi(serviceProviderModel.getRedirecturi());
serviceProviderModel.getRedirecturi().add("");
//spregform.setDefaultModelObject(serviceProviderModel);
spregform.modelChanged();
target.add(spregform);
target.add(container);
//target.add(formUpdateIcon);
//target.add(container);
}
};
--------------------------------------------------------------------
----------------------------------->
To boldly go where no man has gone before.
--------------------------------------------------------------------
----------------------------------->
We do this not because it is easy. We do this because it is hard.
-----------------------------------------------------------------
-------------------------------------->
If I have seen further it is by standing on the shoulders of giants.
----------------------------------------------------------
--------------------------------------------->
***@gmail.com
--------------------------------------------------------------------------------------------->