【问题标题】:visualforce page render a buttonvisualforce 页面呈现一个按钮
【发布时间】:2012-07-18 10:13:23
【问题描述】:

这是我的输出字段代码。当字段为空时呈现按钮,当字段具有值时,清除按钮将显示并允许我清空字段并再次呈现按钮。但是一旦清除该字段,我就无法管理它以再次呈现按钮,有人可以建议修复吗?

<apex:pageBlockSectionItem >
  <apex:outputLabel value="Order:" for="callerorder"/>
  <apex:outputPanel id="callerorder">
    <apex:outputField value="{!newPhoneCallRecord.Order__c}" />
    <apex:commandButton value="x" rendered="{!!ISBLANK(newPhoneCallRecord.Order__c)}" rerender="phoneRecordSection">
      <apex:param name="orderRMV" value="" assignTo="{!newPhoneCallRecord.Order__c}"/> 
    </apex:commandButton>
  </apex:outputPanel>

【问题讨论】:

    标签: salesforce visualforce


    【解决方案1】:

    李,

    鉴于您希望它是动态的,您可能应该使用 javascript 启用/禁用该按钮。通过利用onChange 事件,您可以根据需要切换按钮的可见性。

    也就是说,使用&lt;apex:param&gt; 分配一个空值似乎有点偏左。通过控制器清除此字段的更标准方法是在控制器上实现一个 clear 方法,如下所示:

    public PageReference ClearOrder()
    {
      newPhoneCallRecord.Order__c = "";
      return null;
    }
    

    然后从命令按钮调用这个方法:

    <apex:outputPanel id="callerorder">
      <apex:outputField value="{!newPhoneCallRecord.Order__c}" />
      <apex:commandButton value="x" rendered="{!!ISBLANK(newPhoneCallRecord.Order__c)}" rerender="phoneRecordSection" action="{!ClearOrder}"/>
    </apex:outputPanel>
    

    【讨论】:

    • 嗨莱西,考虑到我们都在墨尔本,我可以请你喝一杯吗?
    • 嗨,Lee,我们确实需要让当地社区更加活跃和社交,您参加过任何用户组聚会吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-02
    • 1970-01-01
    • 1970-01-01
    • 2010-10-13
    • 2011-09-20
    • 2021-02-11
    相关资源
    最近更新 更多