<apex:repeat value="{!comp_set}" var="fieldName">
<div class="form-group">
    <label for="emailaddress" class="col-sm-4 control-label">{!fieldName}</label>
    <div class="col-sm-8">
        <p class="p-values">
            <apex:outputText value="{!$CurrentPage.parameters.[fieldName]}"/>

Is there a way we can display like this in visualforce page. I tried it but it has an error.

Save error: Expression of type Text cannot be subscripted.

The value of nationality__c and religion__c is what I want to display in the output.

    14:31:15.443 (443045689)|SYSTEM_METHOD_EXIT|[167]|System.debug(ANY)

But when I used this <apex:outputText value="{!$CurrentPage.parameters.religion__c}"/>

It display this:

enter image description here

  • Are you sure you passed the correct parameter in the URL... can you post the URL you are trying to hit and full code of the output text – Amr Ibrahim Aug 25 '15 at 6:47
  • I updated the post sir. – Lennon Leopoldo Aug 25 '15 at 6:53
  • Check for . when you accessing map values, trye <apex:outputText value="{!$CurrentPage.parameters[fieldName]}"/> – highfive Aug 25 '15 at 7:11
  • I tried it already. But still the same error. – Lennon Leopoldo Aug 25 '15 at 7:17
  • Are you allowed to use a controller? Then you could grab all of the page parameters in the controller local map and try to access them as a controller property. One more thought your field name value is Religion but the parameter is religion__c right? – zokito Aug 25 '15 at 8:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.