ページの読み込み時に jquery を使用してフォーム属性から値を取得しようとすると、「オブジェクトはこのプロパティまたはメソッドをサポートしていません」という Java スクリプト エラーが発生します。これに関する問題を教えてください。
alert($("[name=searchAttribute.brand.attributeValue]").val());
struts2 と Jquery を使用しています。アクション内には、この内部に ValueObject 属性として searchAttribute があり、別の属性としてブランドがあり、その内部には別の属性として attributeValue があります。
ページの読み込み時に、この値に基づいてドロップダウンを読み込む必要があります。
<script type="text/javascript">
$(document).ready(
function() {
fetchDropDownValues($("#idGMMHouse").val(),'<s:property value="brandloadUrl"/>','idGMMBrand','idGMMLine');
var fieldname = '';
alert($("[name="+ 'searchAttribute.brand.attributeValue' +"]").val());
});
</script>
<tr>
<td width="80px"><s:text name="filter.price.gmmhouse" /></td>
<td width="1px"><s:text name="filter.colon" /></td>
<td width="270px"> <s:select cssClass="drop" tabindex="1"
listKey="code" listValue="value" headerKey="0"
headerValue="Select One"
onchange="fetchDropDownValues(this.value,'%{brandloadUrl}','idGMMBrand','idGMMLine');" id="idGMMHouse"
name="searchAttribute.house.attributeValue" list="lstGMMHouse"></s:select></td>
<td width="80px"><s:text name="filter.price.gmmbrand" /></td>
<td width="1px"><s:text name="filter.colon" /></td>
<td width="160px"><s:url action="loadGMMLineDropDown"
id="lineloadUrl"></s:url><s:select cssClass="drop" tabindex="1"
id="idGMMBrand"
onchange="fetchDropDownValues(this.value,'%{lineloadUrl}','idGMMLine');"
headerKey="0" headerValue="Select One"
name="searchAttribute.brand.attributeValue" list="{}"></s:select></td>
<td width="80px"><s:text name="filter.brand.desc" /></td>
<td width="1px"><s:text name="filter.colon" /></td>
<td width="270px"><s:select cssClass="drop" tabindex="1"
id="idGMMLine" headerKey="0" headerValue="Select One"
name="searchAttribute.line.attributeValue" list="{}"></s:select></td>
<td align="LEFT"> </td>
</tr>