在xhtml的jsf2.0中jquery自动完成工作正常,但是当我试图在select函数中设置值来支持bean它没有设置,我用过
<div class="ui-widget" style="font-size: 0.9em; padding-left: 0.3em;" >
<label for="organizatiosSelectAuto">Representative Organization: </label>
<h:inputText id="organizationSelectAuto"/>
</div>
<h:inputText id="orgIDHidden" value="#{letterMBean.orgID}" style="" immediate="true" onchange="submit()" valueChangeListener="#{letterMBean.orgChanged(this)}"/>
$(function() {
var availableTags = #{jqueryClientList.arrayObj} ;
$( '#organizationSelectAuto' ).autocomplete({
source: availableTags,
minLength: 2,
select: function( event, ui ) {
alert("id"+ui.item.id);
document.getElementById('housefrm:orgIDHidden').value = ui.item.id;
alert("input Text vlaue"+document.getElementById('housefrm:orgIDHidden').value);
}
});
});
答案 0 :(得分:0)
它开始工作,因为我必须在选择
之后在jquery函数中提交表单<h:commandButton id="populateOrgId" action="#{letterMBean.orgChanged}" style="display: none" > </h:commandButton> document.getElementById('housefrm:populateOrgId').click();