0
<!--Visual force page code-->

<apex:page controller="prgrm9cls"><apex:form >
<apex:pageBlock >


<apex:pageblockSection >
<apex:selectRadio value="{!paymentstatus}" id="paymentstatus">
<apex:selectOption itemValue="Credit" itemLabel="credit card" ></apex:selectOption>
<apex:selectOption itemValue="Po" itemLabel="PO"></apex:selectOption>
<apex:selectOption itemValue="Invoice" itemLabel="Invoice"></apex:selectOption>
<apex:actionSupport event="onchange" reRender="opid2" action="{!act}"/></apex:selectRadio></apex:pageblockSection>



<apex:pageBlockSection >

<apex:outputPanel id="opid2">
<apex:pageBlockSection rendered="{!cardz}" columns="1">
<apex:pageblockSectionItem >
<apex:outputLabel value="Credit Card Name"></apex:outputLabel><apex:inputText value="{!creditname}"  />
</apex:pageblockSectionItem>
<apex:pageblockSectionItem >
<apex:outputLabel value="Credit CardNumber"></apex:outputLabel><apex:inputText value="{!CardNumber}" />
</apex:pageblockSectionItem>
<apex:pageblockSectionItem >
<apex:outputLabel value="CVV"></apex:outputLabel><apex:inputText value="{!CVV}" />
</apex:pageblockSectionItem></apex:pageBlockSection>

<apex:pageBlockSection rendered="{!invoicess}">
<apex:outputLabel value="Invoice"></apex:outputLabel><apex:inputText value="{!Invoice}" />
</apex:pageBlockSection>

<apex:pageBlockSection rendered="{!pozz}">
<apex:outputLabel value="Routing Number"></apex:outputLabel><apex:inputText value="{!porder}" required="true"/></apex:pageBlockSection></apex:outputPanel>

</apex:pageBlockSection>

</apex:pageBlock>

 </apex:form></apex:page>
public class prgrm9cls {

    public String CVV { get; set; }

    public Integer CardNumber { get; set; }

    public String creditname { get; set; }

    public String porder { get; set; }

    public boolean pozz { get; set; }
 public String paymentstatus { get; set; }
    public String Invoice { get; set; }

    public boolean invoicess { get; set; }

       public boolean cardz { get; set; }

    public PageReference act() {

       if(paymentstatus == 'Credit'){
       cardz = true;
       invoicess = false;
       pozz = false;
       }
       if(paymentstatus == 'Invoice'){
       cardz = false;
       invoicess =true;
       pozz = false;
       }
       if(paymentstatus == 'po'){
       cardz = false;
       invoicess =false;
       pozz = true;
       }

       return null;
       }



    }

当我单击任一单选选项时,它应该显示它的相关文本。它只执行了前两次并且无法连续工作。

任何人都可以解释所做的错误

提前致谢。

4

1 回答 1

0

对不起,我发现了错误。这是由于面板中使用了“必需”选项而导致的。在“路由号码”中删除了该选项

<apex:outputLabel value="Routing Number"></apex:outputLabel><apex:inputText value="{!porder}" required="true"/>

这已经解决了这个问题。

谢谢,Salesforce 工程师 Ravindra。

于 2013-09-17T10:19:04.367 回答