基于另一个自动建议输入的自动建议值
我正在研究图书馆类型的数据库。假设我想创建 2 个输入字段(使用 PHP),每个输入字段都有自己的自动建议功能,以帮助过滤用户的选择。然而,字段 #2 中填充的值将取决于用户在字段 #1 中搜索和选择的值。我想知道是否应该使第二个字段处于非活动状态,直到在字段 #1 中正确搜索并选择有效值(存在于数据库中)。
字段 1:自动建议搜索库列表。
字段 2:在字段 1 中输入正确的图书馆后,字段 2 将能够自动建议该图书馆中包含的书籍。
我想在一个页面中完成这个两步自动建议,而不是将用户移动到另一个页面以搜索所选图书馆中的书籍。
我正在与很多库合作,因此下拉列表对于字段 #1 没有多大意义。
我的数据库中有一个“books_library”表,每个表都有一个 bookID 以及一个图书馆 ID,表明它属于该特定图书馆。我可以轻松地用所有书籍填充字段 #2 自动建议,问题是,如何根据字段 #1 生成的图书馆 ID 过滤字段 #2 中的自动建议?
有谁知道此类项目的正确名称吗?我在谷歌中找不到类似的东西。最接近的是基于前一个下拉列表中选择的值的一个又一个的下拉列表。但我正在处理的数据比下拉菜单可以以用户友好的方式提供的数据多得多。
请帮忙!
I am working on a library type database. Supposed I want to create 2 input fields (using PHP) each having its own autosuggest capability in order to help filter user's selection. However, the values to be populated in field #2 will be dependent upon the value searched and selected by the user in field #1. I wonder if I should even make the 2nd field inactive until a valid value (that exists in the database) is properly searched and selected in field #1.
Field 1: Autosuggesting searches for a list of libraries.
Field 2: Upon entering a proper library in field 1, field 2 would be able to autosuggest books that are contained within that library.
I want to accomplished this 2-step autosuggest all in one page, as opposed to moving the user to a whole another page in order to search the books within the selected library.
I am working with a lot of libraries, so a drop down list doesn't make much sense for field #1.
I have a "books_library" table in my database that each has a bookID as well as a library ID showing that it belongs to that particular library. I can easily populate field #2 autosuggest with all the books, the problem is, how do I filter the autosuggest in field #2 based on the library ID generated from field #1?
Does anyone know a proper name for this sort of project? I could not find anything like this in google. The closest thing is a drop-down list one after another based on values selected in a previous drown down list. But I am working with a lot more data than drop-downs can provide in a user friendly manner.
Please help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我会更进一步,在他们这样做之前我不会展示它。听起来您想使用 自动完成 jquery ui 插件 (或来自其他库的自动完成插件 - )
至于使用从第一个文本框中选择的内容作为第二个文本框,将一个函数绑定到第一个自动完成的选择事件,该事件将数据发送到服务器以在显示第二个自动完成之前准备“源” 。
I would go one step further and not show it until they've done so. It sounds like you want to use the autocomplete jquery ui plugin (or an autocomplete plugin from some other library - there's more than one.)
As far as using what's been selected from the first text box for the second, bind a function to the select event of the first autocomplete that sends data to the server to prime the "source" before showing the second autocomplete.