如果 AutoCompleteExtender 没有返回结果,则重置 HiddenField
您好,如果我的 AutoCompleteExtender 没有返回结果(特别是,如果用户搜索不在列表/数据库中的内容),我需要能够重置 HiddenField 的值。我现在有这个 JS 代码:
function autoCompleteItemSelected(source, eventArgs) {
var assocHiddenField = document.getElementById(source.get_id() + '_hidden');
assocHiddenField.value = eventArgs.get_value();
}
如何修改它来检查列表是否为空?目前,它似乎只是保留以前的值。
谢谢
Hi i need to be able to reset a HiddenField's value if my AutoCompleteExtender returns no results (specifically, if the user searches for something that's not in the list/database). I have this JS code now:
function autoCompleteItemSelected(source, eventArgs) {
var assocHiddenField = document.getElementById(source.get_id() + '_hidden');
assocHiddenField.value = eventArgs.get_value();
}
How would I modify this to check if the list is null? Currently it seems to just leave the value as it was previously.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我尝试将 null 和一个空数组设置为hiddenInput 的值,并且两者都工作正常。
您能提醒一下 assocHiddenField.value 的值吗?
I tried to set null and an empty array to the value of the hiddenInput and both work fine.
Could you alert the value of assocHiddenField.value?