如果您检出 thecomputerwarehouse/test.php ,则可以看到正常的我要完成的事的例子.您可以输入"q"以显示列表中的结果.
If you check out thecomputerwarehouse/test.php you can see a working example of what I am trying to accomplish. You can type "q" to show results from the list.
我使用的是我在网上找到的一些自家编写的脚本,基本上,我试图自动填充列表并选择记录,然后将值插入工作正常的字段中.
I am using some home grown scripts I have found on the web and basically I am trying to auto populate a list and select the record which then inserts the value into the field which is working fine.
我要弄清楚的是,当您单击添加另一个序列号"时,它会为您提供另一个字段.问题在于,除了第一个字段外,下一个字段不会自动填充列表.
What I am trying to figure out is when you click the "add another serial number" it then gives you another field. The problem is that the next field(s) besides the first one will not auto populate the list.
在我拥有的javascript中
In the javascript where I have
newdiv.innerHTML = "Serial Number " + (counter + 1) + " <br><input type='text' name='course"+(counter + 1)+"' id='course"+(counter + 1)+"'>";我正在尝试将计数器添加到它,以便它广告一个唯一的ID名称.问题是我不知道如何将相同的内容应用于
I am trying to add the counter to it so that it ads a unique id name. The problem is that I can't figure out how to apply the same thing to the ajax code in
$("#course").autocomplete("getinventoryajax.php", {因为第一个字段被命名为"course",所以我需要能够使用javascript更改该字段,而ajax也需要以某种方式来识别它.由于我知道所有其他字段未自动填充的原因,因为以下字段的名称被重复为课程",从而破坏了代码.
since the first field is named "course" I need to be able to change the field with the javascript and somehow the ajax needs to recognize that as well. Since I know the reason all the other fields are not auto populating because the name of the following fields is being repeated as "course" which breaks the code.
有什么建议吗?
更新
我终于弄清楚了如何完成我需要完成的工作.我需要将自动完成功能添加到我的JS中,这最终解决了我的问题.Nameisnull有一个链接帮助了我:)谢谢
I finally figure out how to accomplish what I needed done. I needed to add the autocomplete to my JS which ultimatly fixed my issue. There is a link from Nameisnull helped me out :) thanks
推荐答案问题是新添加的元素没有自动完成绑定的元素(保留所做的更改).
The problem is that the new added elements do not have autocomplete bounded to them (keep the changes you've made).
您应该查看此
更多推荐
用ajax mysql和javascript自动填充列表
发布评论