<form action="" name="theForm" method="post">
...code for dropdown menus initialized to empty...
<td colspan="1" width="250">
<input type="text" id="CAPS_CODE" name="CAPS_CODE" value=""
onchange="setF('LALA', this.value)" size="20" maxlength="20"/>
<div style="display:none;" id="CAPS_CODE$err">
<span style="color: #FF0000; font-family: Arial,
Helvetica, sans-serif; font-size: 10px;
font-weight: bold; text-decoration: none;">
</span>
</div>
</td>
`....form submit button in HTML and function call here - legacy code that works...`
</form>
基本上这是一个输入文本框。当我输入“ BMW
”并将光标移动到文本框外单击它时,它会将下拉菜单填充为某些值。这就是我所理解onchange
的。我提交表单,页面重新加载。
现在,当我尝试在文本框中输入新值时,例如 enter A
,该值一直被删除。这发生在我单击文本框外部之前。这与表单提交后有关吗?
注意:我在我的 JS 函数调用中使用如下 AJAX,如果这有帮助的话..
var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, capsCallback, postData);
function setF(group_id, caps){
var token = document.theForm.sessionToken.value;
getCarByAjax(token, group_id, caps);
}
function getCarByAjax(sessionToken, group_id, caps){
top.currentDependencyGroup = group_id;
//alert("strs= " + strs);
var entryPoint = '/DropDownList?';
// entryPoint is the base URL
if(top.ctx != null && top.ctx != ""){
entryPoint = top.ctx + '/DropDownList?';
}
var sUrl = entryPoint + encodeURI;
var postData = 'CAPSVEH=' + caps + '&FROM=' + group_id + '&sessionToken=' + sessionToken;
var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, capsCallback, postData);
}