使用 Visualforce“apex:actionSupport”传递 Apex 方法参数值
谁能告诉我如何使用 Visualforce 'apex:actionSupport' 传递 Apex 方法参数值。
Apex 代码:
public void renderField(String sampleType) { }
Visualforce 代码:
<apex:inputField id="sampleType" value="{!job.Sample_Type__c}">
<apex:actionSupport event="onchange" action="{!renderField(?)}" rerender="otherSampleType"/>
</apex:inputField>
Can anyone please tell me how can I pass Apex method parameter value with Visualforce 'apex:actionSupport'.
Apex code:
public void renderField(String sampleType) { }
Visualforce code:
<apex:inputField id="sampleType" value="{!job.Sample_Type__c}">
<apex:actionSupport event="onchange" action="{!renderField(?)}" rerender="otherSampleType"/>
</apex:inputField>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
操作方法不支持传递这样的参数。相反,您只需将 VF 组件绑定到控制器属性即可。就您而言,您似乎可能想要获取“sampleType”inputField 的值。如果是这样,您只需要一个包含对“作业”的引用的控制器属性。假设类型为 Job__c,控制器上的此声明将起作用:
当您的 actionSupport 触发时,将从 inputField 填充
Job.Sample_Type__c
。Action methods don't support passing arguments like that. Instead, you just have to bind VF components to controller properties. In your case, it looks like you may be wanting to get the value of the "sampleType" inputField. If so, you just need a controller property that holds a reference to the "Job". Assuming the type is Job__c, this declaration on the controller would work:
When your actionSupport fires,
Job.Sample_Type__c
will be populated from the inputField.