VisualForce 中未触发事件
在下面的页面中,Topic__c 是一个单选选项列表。我的目的是让这个列表控制下面哪些输入字段可用。用户选择一个选项,onchange 事件应该触发,并重新呈现字段。
<apex:inputField value="{!Call_Report__c.Topic__c}" id="topic" >
<apex:actionSupport event="onchange" reRender="tickerInput,sectorInput,bondInput">
<apex:param name="topicSelection" value="{!Call_Report__c.Topic__c}" />
</apex:actionSupport>
</apex:inputField>
<apex:inputField value="{!Call_Report__c.Tickers__c}" rendered="{!Call_Report__c.Topic__c='Issuer'}" id="tickerInput" />
<apex:inputField value="{!Call_Report__c.Sector__c}" rendered="{!Call_Report__c.Topic__c='Industry'}" id="sectorInput"/>
<apex:inputField value="{!Call_Report__c.Security__c}" rendered="{!Call_Report__c.Topic__c='Specific Bond'}" id="bondInput" />
In the page below,Topic__c is a single-select picklist. My intention is to have this list control which of the input fields is available below. The user selects an option, and the onchange event should fire, and rerender the fields.
<apex:inputField value="{!Call_Report__c.Topic__c}" id="topic" >
<apex:actionSupport event="onchange" reRender="tickerInput,sectorInput,bondInput">
<apex:param name="topicSelection" value="{!Call_Report__c.Topic__c}" />
</apex:actionSupport>
</apex:inputField>
<apex:inputField value="{!Call_Report__c.Tickers__c}" rendered="{!Call_Report__c.Topic__c='Issuer'}" id="tickerInput" />
<apex:inputField value="{!Call_Report__c.Sector__c}" rendered="{!Call_Report__c.Topic__c='Industry'}" id="sectorInput"/>
<apex:inputField value="{!Call_Report__c.Security__c}" rendered="{!Call_Report__c.Topic__c='Specific Bond'}" id="bondInput" />
Am I doing something obviously wrong here? http://community.salesforce.com/t5/Visualforce-Development/Multi-select-picklist-not-firing-event-for-AJAX-refreshes/m-p/173572/highlight/false#M22119 seems to imply that what I am doing is reasonable...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我很确定您需要在比这更高的级别重新渲染,例如的级别或
I'm pretty sure you need to rerender at a higher level than that, like at the level of an
<apex:outputPanel id="thePanel"> or an <apex:page id="thePage">
我同意。尝试将代码包装在 outputPanel 中并重新渲染。
I agree. Try wrapping your code in an outputPanel and rerendering that.