简体   繁体   English

如何在Tapestry5的Textfield中提交自动完成选择值?

[英]How to submit autocomplete select value into Textfield in Tapestry5?

I've got a Textfield with autocomplete and zoneUpdater mixins. 我有一个带有自动完成和zoneUpdater mixins的Textfield。 Based on the typed value, I call service which returns new values for the autocomplete select. 根据输入的值,我调用service返回自动完成选择的新值。 So far, so good. 到现在为止还挺好。 Big problem for me is that autocomplete select doesn't submit chosen value. 对我来说最大的问题是自动完成选择不提交所选值。 I want to update different zone, based on this value. 我想基于此值更新不同的区域。 The way it works now is that I have to submit the whole form and reopen again. 它现在的工作方式是我必须提交整个表格并重新打开。 But that's not what customer wants, it should do it on fly without submitting the form. 但这不是客户想要的,它应该在不提交表格的情况下即时完成。 Is there any solution for this? 这有什么解决方案吗? Thank you. 谢谢。

I want to update different zone, based on this value. 我想基于此值更新不同的区域。

I 've tried to do this with your setup and actually worked but the drawback is that the value I get as the CHANGE event of the input is what the user typed (not what the user selected from the autocomplete list). 我已尝试使用您的设置执行此操作并且实际工作但缺点是我作为输入的CHANGE事件获得的值是用户键入的内容(而不是用户从自动完成列表中选择的内容)。

To get the value from selected from the autocomplete list (although I 've not tried it) you should use the callback parameter of prototype's Autocompleter . 要从自动完成列表中选择值(尽管我没有尝试过),您应该使用prototype的Autocompleter回调参数 Take into account that in order to do this you should rewrite a new Autocompleter mixin of your own as the Tapestry's built-in autocomplete mixin is not honoring that callback parameter. 考虑到为了做到这一点,你应该重写一个新的自动完成混合你自己,因为Tapestry的内置自动完成mixin不尊重该回调参数。

I 've also checked out the tapestry-jquery's Autocomplete mixin and although jquery's autocomplete supports a autocompleteselect event tapestry-jquery is not handling it in it's instantiation. 我还检查了tapestry-jquery的Autocomplete mixin,虽然jquery的autocomplete支持autocompleteselect事件,但 tapestry-jquery并没有在它的实例化中处理它。

I 've not checked the chenille kit autocomplete mixin which maybe can help you, I really don't know. 我没有检查过chenille kit autocomplete mixin,也许可以帮到你,我真的不知道。

As far as I know you should develop your own Autocomplete mixin based on any of these and add to it the selected item event functionality. 据我所知,你应该根据这些中的任何一个开发自己的Autocomplete mixin,并添加所选的项目事件功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM