You need to sign in to do that
Don't have an account?
Shrey Tyagi
Rendered attribute on <apex:outputtext> not working please help.
Hi Everyone,
I need to conditionally render the highlighted apex out put texts but this is not wotking. Can someone please help me with the code below:
Rendered attribute is dependent on value of Variable ResultSize. The variable is showing the correct value hence I am not putting any apex code . The flow of code is gven below:
1. User key in the input values in input text boxes.
2. There is an onkeyup written on the input boxes. Than on key up function calles for a javascript that in turn calls for the apex action function . This apex action function rerenders the attribute. All other id's are being rerendered fine by action function except id's of out put texts size,size1.
<apex:page controller="ProposalSearchControllerModified" sidebar="false" readonly="True">
<apex:form >
<apex:pageMessages id="errors"/>
<apex:pageBlock title="Search Proposal Records" mode="edit" id="OuterPageBlock">
<table width="100%" border="0">
<tr>
<td width="200" valign="top">
<apex:pageBlock title="Search Parameters" mode="edit" id="criteria">
<script type="text/javascript">
function doSearch() {
searchServer(
document.getElementById("Name").value,
document.getElementById("OpportunityID").value,
document.getElementById("SolicitationNo").value,
document.getElementById("ProposalNo").value
);
}
</script>
<apex:actionFunction name="searchServer" action="{!runSearch}" rerender="results,debug,errors,size,size1">
<apex:param name="Name" value="" />
<apex:param name="OpportunityID" value="" />
<apex:param name="SolicitationNo" value="" />
<apex:param name="ProposalNo" value="" />
</apex:actionFunction>
<table cellpadding="2" cellspacing="2">
<tr>
<td style="font-weight:bold;">Opportunity ID<br/>
<input type="text" id="OpportunityID" onkeyup="doSearch();"/>
</td>
</tr>
<tr>
<td style="font-weight:bold;">Solicitation #<br/>
<input type="text" id="SolicitationNo" onkeyup="doSearch();"/>
</td>
</tr>
<tr>
<td style="font-weight:bold;">Proposal #<br/>
<input type="text" id="ProposalNo" onkeyup="doSearch();"/>
</td>
</tr>
<tr>
<td>
<b><apex:outputText id="size" style="font-style:Bold;" value="Total Records Returned : {!ResultSize}" rendered="{!ResultSize<1000}"/></b>
<b><apex:outputText id="size1" style="font-style:Bold;" value="Total Records Returned : {!ResultSize} ++" rendered="{!ResultSize==1000}"/></b>
</td>
</tr>
</table>
</apex:pageBlock>
</td>
<td valign="top">
<table style="width: 100%;">
<td>
<apex:pageBlock mode="edit" id="results">
<div style="overflow: auto; height: 300px;">
<apex:pageBlockTable value="{!Opportunities}" var="opp">
<apex:column >
<apex:facet name="header">
<apex:commandLink value="Opportunity Name" action="{!toggleSort}" rerender="results,debug">
<apex:param name="sortField" value="Name" assignTo="{!sortField}"/>
</apex:commandLink>
</apex:facet>
<!--<apex:outputLink value="/apex/SiteDetailPage?id={!opp.id}" target="_blank" rendered="{!IF(URLL=$Label.SalesforceURL,false,true)}">{!opp.Name}</apex:outputLink>
<apex:outputLink value="/{!opp.id}" target="_blank" rendered="{!IF(URLL=$Label.SalesforceURL,true,false)}">{!opp.Name}</apex:outputLink>-->
<apex:commandlink value="{!opp.Name}" rerender="RecordDetailSection" action="{!ClearOrder}">
<apex:param name="DetailRecordId" value="{!opp.Id}" assignTo="{!DetailRecordId}"/>
</apex:commandlink>
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:commandLink value="Opportunity ID" action="{!toggleSort}" rerender="results,debug">
<apex:param name="sortField" value="OpportunityID" assignTo="{!sortField}"/>
</apex:commandLink>
</apex:facet>
<apex:outputField value="{!opp.Opportunity_ID__c}"/>
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:commandLink value="Proposal #" action="{!toggleSort}" rerender="results,debug">
<apex:param name="sortField" value="ProposalNo" assignTo="{!sortField}"/>
</apex:commandLink>
</apex:facet>
<apex:outputField value="{!opp.Proposal__c}"/>
</apex:column>
</apex:pageBlockTable>
</div>
</apex:pageBlock>
</td>
</tr>
</table>
</td>
</tr>
</table>
</apex:pageBlock>
</apex:form>
</apex:page>
I need to conditionally render the highlighted apex out put texts but this is not wotking. Can someone please help me with the code below:
Rendered attribute is dependent on value of Variable ResultSize. The variable is showing the correct value hence I am not putting any apex code . The flow of code is gven below:
1. User key in the input values in input text boxes.
2. There is an onkeyup written on the input boxes. Than on key up function calles for a javascript that in turn calls for the apex action function . This apex action function rerenders the attribute. All other id's are being rerendered fine by action function except id's of out put texts size,size1.
<apex:page controller="ProposalSearchControllerModified" sidebar="false" readonly="True">
<apex:form >
<apex:pageMessages id="errors"/>
<apex:pageBlock title="Search Proposal Records" mode="edit" id="OuterPageBlock">
<table width="100%" border="0">
<tr>
<td width="200" valign="top">
<apex:pageBlock title="Search Parameters" mode="edit" id="criteria">
<script type="text/javascript">
function doSearch() {
searchServer(
document.getElementById("Name").value,
document.getElementById("OpportunityID").value,
document.getElementById("SolicitationNo").value,
document.getElementById("ProposalNo").value
);
}
</script>
<apex:actionFunction name="searchServer" action="{!runSearch}" rerender="results,debug,errors,size,size1">
<apex:param name="Name" value="" />
<apex:param name="OpportunityID" value="" />
<apex:param name="SolicitationNo" value="" />
<apex:param name="ProposalNo" value="" />
</apex:actionFunction>
<table cellpadding="2" cellspacing="2">
<tr>
<td style="font-weight:bold;">Opportunity ID<br/>
<input type="text" id="OpportunityID" onkeyup="doSearch();"/>
</td>
</tr>
<tr>
<td style="font-weight:bold;">Solicitation #<br/>
<input type="text" id="SolicitationNo" onkeyup="doSearch();"/>
</td>
</tr>
<tr>
<td style="font-weight:bold;">Proposal #<br/>
<input type="text" id="ProposalNo" onkeyup="doSearch();"/>
</td>
</tr>
<tr>
<td>
<b><apex:outputText id="size" style="font-style:Bold;" value="Total Records Returned : {!ResultSize}" rendered="{!ResultSize<1000}"/></b>
<b><apex:outputText id="size1" style="font-style:Bold;" value="Total Records Returned : {!ResultSize} ++" rendered="{!ResultSize==1000}"/></b>
</td>
</tr>
</table>
</apex:pageBlock>
</td>
<td valign="top">
<table style="width: 100%;">
<td>
<apex:pageBlock mode="edit" id="results">
<div style="overflow: auto; height: 300px;">
<apex:pageBlockTable value="{!Opportunities}" var="opp">
<apex:column >
<apex:facet name="header">
<apex:commandLink value="Opportunity Name" action="{!toggleSort}" rerender="results,debug">
<apex:param name="sortField" value="Name" assignTo="{!sortField}"/>
</apex:commandLink>
</apex:facet>
<!--<apex:outputLink value="/apex/SiteDetailPage?id={!opp.id}" target="_blank" rendered="{!IF(URLL=$Label.SalesforceURL,false,true)}">{!opp.Name}</apex:outputLink>
<apex:outputLink value="/{!opp.id}" target="_blank" rendered="{!IF(URLL=$Label.SalesforceURL,true,false)}">{!opp.Name}</apex:outputLink>-->
<apex:commandlink value="{!opp.Name}" rerender="RecordDetailSection" action="{!ClearOrder}">
<apex:param name="DetailRecordId" value="{!opp.Id}" assignTo="{!DetailRecordId}"/>
</apex:commandlink>
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:commandLink value="Opportunity ID" action="{!toggleSort}" rerender="results,debug">
<apex:param name="sortField" value="OpportunityID" assignTo="{!sortField}"/>
</apex:commandLink>
</apex:facet>
<apex:outputField value="{!opp.Opportunity_ID__c}"/>
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:commandLink value="Proposal #" action="{!toggleSort}" rerender="results,debug">
<apex:param name="sortField" value="ProposalNo" assignTo="{!sortField}"/>
</apex:commandLink>
</apex:facet>
<apex:outputField value="{!opp.Proposal__c}"/>
</apex:column>
</apex:pageBlockTable>
</div>
</apex:pageBlock>
</td>
</tr>
</table>
</td>
</tr>
</table>
</apex:pageBlock>
</apex:form>
</apex:page>
You can do the following things:
1. Add a outputpanel surrounding the outputText tags, and
2. Rerender that outputpanel, from the actions you perform.
Mark this as the solution, if it solves your problem.
Thanks