0
JACKSON, MS 39212|39212
BAINVILLE, MT 59212|59212
CROOKSTON, NE 69212|69212
COLUMBIA, SC 29212|29212
SPOKANE, WA 99212|99212
代碼:
<form method="GET" target="_blank">
<fieldset><legend>remote example</legend>
<label for="myRemoteInput">Enter a state:</label>
<div id="myRemoteAutoComplete">
<input id="myRemoteInput" name="myRemoteInput" type="text">
<div id="myRemoteContainer"></div>
</div>
</fieldset>
<input type="submit" />
</form>
<script type="text/javascript">
YAHOO.example.BasicRemote = function() {
var oRDS = new YAHOO.util.XHRDataSource("data.php");
oRDS.responseType = YAHOO.util.XHRDataSource.TYPE_TEXT;
oRDS.responseSchema = {
recordDelim: "\n",
fieldDelim: "|"
};
oRDS.maxCacheEntries = 5;
var oRAC = new YAHOO.widget.AutoComplete("myRemoteInput"
, "myRemoteContainer"
, oRDS
, {minQueryLength: 2,maxResultsDisplayed: 25, forceSelection: true});
return {
oRDS: oRDS,
oRAC: oRAC
};
}();
</script>
方案: 我想顯示與市,ST拉鍊值的自動完成構件,然而,表單字段myRemoteInput總是與所選擇的城市填充,ST郵編值。
問題: 當用戶從自動完成下拉列表中選擇City,ST zip值時,如何使用郵編填充表單字段myRemoteInput的值?