function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Anu-cnpAnu-cnp 

Rendered not working properly

Hi,

 

Here is my code,

 

<apex:pageBlockSection title="Payment Method" columns="1">
<apex:pageblocksectionItem >
  <apex:outputlabel value="Payment is done through" for="compare" />

        <apex:selectList id="compare" value="{!compare}"  required="true"  size="1" >
        <apex:actionSupport event="onchange" reRender="newvalue" />
<apex:actionStatus startText="Processing...."/>
              <apex:selectOptions value="{!comparison}"  />
         </apex:selectList>
         </apex:pageblocksectionItem>

         <apex:outputPanel id="newvalue">

<apex:outputpanel rendered="{!compare=='Invoice'}" >
<div style="position:relative;left:75px;">   
<apex:outputlabel for="number" />
<b>Invoice Number:</b>
<apex:inputField value="{!newTransaction.Invoice_Check_Number__c}" id="number"/>
</div>
</apex:outputpanel>
<apex:outputpanel rendered="{!compare=='Cash'}" >
<div style="position:relative;left:75px;">   
<apex:outputlabel for="number2" />
<b>Receipt Number:</b>
<apex:inputField value="{!newTransaction.Invoice_Check_Number__c}" id="number2"/>
</div>
</apex:outputpanel>
<apex:outputpanel rendered="{!compare=='Purchase Order'}" >
<!--<div style="position:relative;left:75px;">  -->
<apex:outputlabel for="number3" />
<b>Purchase Order Number: </b>
<apex:inputField value="{!newTransaction.Invoice_Check_Number__c}" id="number3"/>
<!--</div>-->

</apex:outputpanel>
</apex:outputPanel>
 
       </apex:pageBlockSection> 

 

 

Apex Class:

 

public string compare{get;set;}

 

public List<SelectOption> getComparison()
{
System.debug('hii'+compare);
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('Cash','Cash'));
options.add(new SelectOption('Invoice','Invoice'));
options.add(new SelectOption('Purchase Order','Purchase Order'));
return options;

}

 

 

My problem is I want to render the text field with label based on picklist values.I'm getting the compare value successfulyy. but I'm not able to rendered properly.

 

 

Any one can help me please.