我正在转换旧的双下拉框搜索表单。随着老方法,提交表单上使用这种每个用户选择:Jquery自动完成提交表单
<form name="navTwo">
<select name="item" id="item" onChange="document.location.href=document.navTwo.game.options[document.navTwo.game.selectedIndex].value">
与老方法的问题是,用户被迫寻找直通包含数量不断增长的第二个选项下拉菜单。
我选择使用一个自动提交下拉菜单和新的jquery类型提前搜索字段进行新搜索(感谢Jamie McConnell,[email protected])。一切都与未来的类型很好。但是,我无法知道如何提交新的表单,一旦用户选择类型在前的项目。理想情况下,我希望强制用户在选择第二项后点击提交。
我试着携带第二个搜索项目的id并将其放置在隐藏的输入中,但我无法将变量设置为id。这是我迄今为止所尝试的,失败的;
//页面名称是dash3.php
//如果list = 1,将添加记录
// jQuery的东西,做工精细,它增加值输入栏,我需要它来抓取该记录的标识,而不仅仅是标题。 $ vid是空的,不知道如何设置它。
//下面的代码缺少提交按钮,我尝试添加一个链接,以便可以看到变量。
<form name="nav">
<div>
Start typing the name of the item, select the correct title when it appears:<br />
<input type="text" size="30" value="" id="inputString" onkeyup="lookup(this.value);" onblur="fill();" />
<input type="hidden" value="?list=1&ptfm_ctrl=1&vid=<?=$vid?>" />
</div>
<div class="suggestionsBox" id="suggestions" style="display: none;">
<img src="upArrow.png" style="position: relative; top: -12px; left: 30px;" alt="upArrow" />
<div class="suggestionList" id="autoSuggestionsList">
</div>
</div>
<a href="dash3.php?list=1&hid=<?=$hid?>&vid=<?=$vid?>"><strong>+</strong></a>
</form>
所以,为了让我的问题更清楚;
如何获取jquery自动完成脚本在输入字段中放置的提前记录类型的id,并将自身引用表单携带此id到同一页面?
非常感谢!
您好史蒂夫,请发布您用于自动完成的jQuery/javascript代码 – tusar 2012-03-21 14:50:40
这里是我抓住的代码... http://www.nodstrum.com/2007/09/19/autocompleter/ – 2012-03-21 16:08:41