0

xhtml 中 jsf2.0 中的 Jquery 自动完成工作正常,但是当我尝试在选择函数中为支持 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);
            }
        });
    });
4

1 回答 1

0

它开始工作,因为我必须在选择后在 jquery 函数中提交表单

<h:commandButton id="populateOrgId" action="#{letterMBean.orgChanged}" style="display: none" >     </h:commandButton> document.getElementById('housefrm:populateOrgId').click();
于 2012-07-12T22:36:19.420 回答