2012-07-18 195 views
0

这里是我的输出字段的代码。当字段为空时,按钮被渲染,当字段有值时,清除按钮将显示并允许我清空字段并再次渲染按钮。但是我无法管理它在字段清除后再次显示按钮,任何人都可以提出修复建议吗?visualforce页面渲染按钮

<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> 

回答

2

利,

既然你想这是动态的,你应该启用/使用javascript禁用按钮。通过利用onChange事件,您可以根据需要切换按钮的可见性。

也就是说,使用<apex:param>来分配一个空值似乎是一种左倾的情况。通过控制器来清除此字段中的多个标准的方式是实现像这样的控制器上的清零方法:

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> 
+0

嗨莱西, 考虑到我们都在墨尔本,我可以给你买一杯饮料吗? – 2012-07-18 02:29:06

+0

您必须因您对社区的贡献而获得奖励。 – 2012-07-18 02:34:56

+0

李嗨,我们确实需要让本地社区更加活跃和社交,您是否参加过任何用户组会议? – 2012-07-19 11:09:29