gwt动态添加文本框
@UiHandler("addDynamicTextboxbutton")
void addMoreTextbox(ClickEvent event) {
textboxplaceholder.add(new TextBox(),"textboxplace");
}
当单击 addDynamicTextboxbutton 按钮时,将执行此方法并创建新的文本框。如何有另一个按钮,以便单击时,将从每个“textbox()”获取所有值?或者是否有必要输入名称“新文本框(“名称”)”以便我可以获得它们的所有值?执行此操作的最佳实践方法是什么?
@UiHandler("addDynamicTextboxbutton")
void addMoreTextbox(ClickEvent event) {
textboxplaceholder.add(new TextBox(),"textboxplace");
}
when addDynamicTextboxbutton button is clicked, this method is executed and new textbox is created. how to have another button, so that when click, will get all the values from each of the "textbox()" ? or is it necessary to put name "new textbox("name")" so that i can get all their values? what is the best practice way to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果
textboxplaceholder
是ComplexPanel
的扩展,例如FlowPanel
,您可以简单地迭代FlowPanel
的子级:If
textboxplaceholder
is and extend of aComplexPanel
, for exampleFlowPanel
you could simply iterate over the children of theFlowPanel
:您可以使用集合来存储新添加的
TextBox
,稍后您可以从中获取所有值。像这样的事情:迭代存储在
boxes
中的框以获取所有值。You could use a collection to store the newly added
TextBox
from which you can later get all the values. Something like this:Iterate over the boxes stored in
boxes
to get all the values.