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
vishwa attikerivishwa attikeri 

Problem in Rendered in apex:outputpanel

Hi,

I need help on Rendered functions, may be i am wrong with below code.

can any one please help me on this 

 

i have a variable 'total' that contains some integer value this total will change depending on picklist by 'apex:actionsupport'.

here i have one button which will disable and enable with condition for

Ex: if total=50  enable the button 

if total!=50 disable button

here is my code

<apex:form >
<table class="list" >
<tr>
	<td><b>field one</b></td>
	
    <td><apex:selectList value="{!licens}"  size="1">
				<apex:selectOptions value="{!Licenses}"/>
				<apex:actionSupport event="onchange" action="{!test}" reRender="lcnc,totl,counter" />
		</apex:selectList></td>
	
	<td><apex:outputtext id="lcnc" value="{!licenses_Customer_have_Value}"/></td>
</tr>

<tr>
	<td><b>other Reason</b> </td>
	
	<td> <apex:selectList value="{!Reason}"  size="1">
			<apex:selectOptions value="{!Reasons}"/>
			<apex:actionSupport event="onchange" action="{!test}" reRender="Add,totl,counter" />
		</apex:selectList></td>
	
	<td> <apex:outputtext id="Add" value="{!other_Reason_Value}"/></td>
</tr>
                        
<tr>
	<td align="right"><b>Total</b> </td>
	
	<td > &nbsp;</td>
	
	<td > <apex:Outputtext id="totl" value="{!Total}"/>	</td>
</tr>
</table>

<apex:outputpanel id="counter" rendered="{!Total > 85}">
	<apex:commandbutton action="{!Updatecase}" value="Update"  />
</apex:outputpanel>
 </apex:form>

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
Rahul SharmaRahul Sharma

Hi Vishwa, Id and Rendered attribute don't work if used for same component, sometimes.

 

Try splitting them across the two components like done below.:

<apex:outputpanel id="counter" >
	<apex:commandbutton action="{!Updatecase}" value="Update" rendered="{!Total > 85}"/>
</apex:outputpanel>

All Answers

Rahul SharmaRahul Sharma

Hi Vishwa, Id and Rendered attribute don't work if used for same component, sometimes.

 

Try splitting them across the two components like done below.:

<apex:outputpanel id="counter" >
	<apex:commandbutton action="{!Updatecase}" value="Update" rendered="{!Total > 85}"/>
</apex:outputpanel>
This was selected as the best answer
BharathimohanBharathimohan

Hi,

 

Yes Rahul is correct.

The output might not be rendered at the very first time of page load which is because rendered=false.

Further on refreshing this via AJAX will not work, since the id of the component will not be created in the page.

 

 

Checkout this link,

http://bobbuzzard.blogspot.co.uk/2011/02/visualforce-re-rendering-woes.html

 

 

 

Regards,

Bharathi
Salesforce For All

vishwa attikerivishwa attikeri

Thank you