Skip to main content
added 30 characters in body
Source Link
Xtremefaith
  • 4.6k
  • 5
  • 44
  • 96
<apex:repeat id="myRepeat">
    <apex:outpanel id="myWrapper"
    <!-- If user has admin permissions -->
    <apex:outputPanel rendered="{!$Permission.AdminPermission}">
        <a href="/{!record.Id}" target="_blank">
            <apex:outputPanel layout="block">Record# {!record.Id}</apex:outputPanel>
        </a>
    </apex:outputPanel>
    <!-- If user does NOT have admin permissions -->
    <apex:outputPanel rendered="{!!$Permission.AdminPermission}">
        <apex:outputPanel layout="block">Record# {!record.Id}</apex:outputPanel>
    </apex:outputPanel>
    <!-- Input text with onchange actionFunction method -->
    <apex:inputText value="{!rowUnits}" onChange="updateUnits(this)"/>
</apex:repeat>

<!-- Action Functions -->
<apex:actionFunction 
    action="{!setUnits}" 
    name="updateUnitsAction" 
    reRender="{!$Component.myRepeat.myWrapper}">
</apex:actionFunction>

<apex:commandButton value="Submit" action="{!process}" rerender="errors, {!$Component.myRepeat.myWrapper}/>
<apex:repeat id="myRepeat">
    <apex:outpanel id="myWrapper"
    <!-- If user has admin permissions -->
    <apex:outputPanel rendered="{!$Permission.AdminPermission}">
        <a href="/{!record.Id}" target="_blank">
            <apex:outputPanel layout="block">Record# {!record.Id}</apex:outputPanel>
        </a>
    </apex:outputPanel>
    <!-- If user does NOT have admin permissions -->
    <apex:outputPanel rendered="{!!$Permission.AdminPermission}">
        <apex:outputPanel layout="block">Record# {!record.Id}</apex:outputPanel>
    </apex:outputPanel>
    <!-- Input text with onchange actionFunction method -->
    <apex:inputText value="{!rowUnits}" onChange="updateUnits(this)"/>
</apex:repeat>

<!-- Action Functions -->
<apex:actionFunction 
    action="{!setUnits}" 
    name="updateUnitsAction" 
    reRender="{!$Component.myRepeat.myWrapper}">
</apex:actionFunction>

<apex:commandButton value="Submit" action="{!process}" rerender="errors, {!$Component.myRepeat.myWrapper}/>
<apex:repeat id="myRepeat">
    <apex:outpanel id="myWrapper"
    <!-- If user has admin permissions -->
    <apex:outputPanel rendered="{!$Permission.AdminPermission}">
        <a href="/{!record.Id}" target="_blank">
            <apex:outputPanel layout="block">Record# {!record.Id}</apex:outputPanel>
        </a>
    </apex:outputPanel>
    <!-- If user does NOT have admin permissions -->
    <apex:outputPanel rendered="{!!$Permission.AdminPermission}">
        <apex:outputPanel layout="block">Record# {!record.Id}</apex:outputPanel>
    </apex:outputPanel>
    <!-- Input text with onchange actionFunction method -->
    <apex:inputText value="{!rowUnits}" onChange="updateUnits(this)"/>
</apex:repeat>

<!-- Action Functions -->
<apex:actionFunction 
    action="{!setUnits}" 
    name="updateUnitsAction" 
    reRender="{!$Component.myRepeat.myWrapper}">
</apex:actionFunction>

<apex:commandButton value="Submit" action="{!process}" rerender="errors, {!$Component.myRepeat.myWrapper}/>
<apex:repeat id="myRepeat">
    <apex:outpanel id="myWrapper"
    <!-- If user has admin permissions -->
    <apex:outputPanel rendered="{!$Permission.AdminPermission}">
        <a href="/{!record.Id}" target="_blank">
            <apex:outputPanel layout="block">Record# {!record.Id}</apex:outputPanel>
        </a>
    </apex:outputPanel>
    <!-- If user does NOT have admin permissions -->
    <apex:outputPanel rendered="{!!$Permission.AdminPermission}">
        <apex:outputPanel layout="block">Record# {!record.Id}</apex:outputPanel>
    </apex:outputPanel>
    <!-- Input text with onchange actionFunction method -->
    <apex:inputText value="{!rowUnits}" onChange="updateUnits(this)"/>
</apex:repeat>

<!-- Action Functions -->
<apex:actionFunction 
    action="{!setUnits}" 
    name="updateUnitsAction" 
    reRender="{!$Component.myRepeat.myWrapper}">
</apex:actionFunction>

<apex:commandButton value="Submit" action="{!process}" rerender="errors, {!$Component.myRepeat.myWrapper}/>
Edited with command button, inputtext onchange, and wrapper section markup
Source Link
Xtremefaith
  • 4.6k
  • 5
  • 44
  • 96

Has anyone else experienced issues with permission based elements on visualforce when rerendering a section?

For example I have a section that for administrators will provide a link but for common users it would just display the text like so:

<apex:repeat id="myRepeat">
    <apex:outpanel id="myWrapper"
    <!-- If user has admin permissions -->
    <apex:outputPanel rendered="{!$Permission.AdminPermission}">
        <a href="/{!record.Id}" target="_blank">
            <apex:outputPanel layout="block">Record# {!record.Id}</apex:outputPanel>
        </a>
    </apex:outputPanel>
    <!-- If user does NOT have admin permissions -->
    <apex:outputPanel rendered="{!!$Permission.AdminPermission}">
        <apex:outputPanel layout="block">Record# {!record.Id}</apex:outputPanel>
    </apex:outputPanel>
    <!-- Input text with onchange actionFunction method -->
    <apex:inputText value="{!rowUnits}" onChange="updateUnits(this)"/>
</apex:repeat>

<!-- Action Functions -->
<apex:actionFunction 
    action="{!setUnits}" 
    name="updateUnitsAction" 
    reRender="{!$Component.myRepeat.myWrapper}">
</apex:actionFunction>

<apex:commandButton value="Submit" action="{!process}" rerender="errors, {!$Component.myRepeat.myWrapper}/>

When the page first loads this works exactly as expected but then when I rerender the section that contains this portion of markup the permission that once worked (granting the link) is now false (showing just the text). If I refresh the page I again have the admin link.

Appreciate any feedback, thanks!

Edited with command button, inputtext onchange, and wrapper section markup

Has anyone else experienced issues with permission based elements on visualforce when rerendering a section?

For example I have a section that for administrators will provide a link but for common users it would just display the text like so:

<!-- If user has admin permissions -->
<apex:outputPanel rendered="{!$Permission.AdminPermission}">
    <a href="/{!record.Id}" target="_blank">
        <apex:outputPanel layout="block">Record# {!record.Id}</apex:outputPanel>
    </a>
</apex:outputPanel>
<!-- If user does NOT have admin permissions -->
<apex:outputPanel rendered="{!!$Permission.AdminPermission}">
    <apex:outputPanel layout="block">Record# {!record.Id}</apex:outputPanel>
</apex:outputPanel>

When the page first loads this works exactly as expected but then when I rerender the section that contains this portion of markup the permission that once worked (granting the link) is now false (showing just the text). If I refresh the page I again have the admin link.

Appreciate any feedback, thanks!

Has anyone else experienced issues with permission based elements on visualforce when rerendering a section?

For example I have a section that for administrators will provide a link but for common users it would just display the text like so:

<apex:repeat id="myRepeat">
    <apex:outpanel id="myWrapper"
    <!-- If user has admin permissions -->
    <apex:outputPanel rendered="{!$Permission.AdminPermission}">
        <a href="/{!record.Id}" target="_blank">
            <apex:outputPanel layout="block">Record# {!record.Id}</apex:outputPanel>
        </a>
    </apex:outputPanel>
    <!-- If user does NOT have admin permissions -->
    <apex:outputPanel rendered="{!!$Permission.AdminPermission}">
        <apex:outputPanel layout="block">Record# {!record.Id}</apex:outputPanel>
    </apex:outputPanel>
    <!-- Input text with onchange actionFunction method -->
    <apex:inputText value="{!rowUnits}" onChange="updateUnits(this)"/>
</apex:repeat>

<!-- Action Functions -->
<apex:actionFunction 
    action="{!setUnits}" 
    name="updateUnitsAction" 
    reRender="{!$Component.myRepeat.myWrapper}">
</apex:actionFunction>

<apex:commandButton value="Submit" action="{!process}" rerender="errors, {!$Component.myRepeat.myWrapper}/>

When the page first loads this works exactly as expected but then when I rerender the section that contains this portion of markup the permission that once worked (granting the link) is now false (showing just the text). If I refresh the page I again have the admin link.

Appreciate any feedback, thanks!

Edited with command button, inputtext onchange, and wrapper section markup

Source Link
Xtremefaith
  • 4.6k
  • 5
  • 44
  • 96

Visualforce: Issues with $Permission when rerendering

Has anyone else experienced issues with permission based elements on visualforce when rerendering a section?

For example I have a section that for administrators will provide a link but for common users it would just display the text like so:

<!-- If user has admin permissions -->
<apex:outputPanel rendered="{!$Permission.AdminPermission}">
    <a href="/{!record.Id}" target="_blank">
        <apex:outputPanel layout="block">Record# {!record.Id}</apex:outputPanel>
    </a>
</apex:outputPanel>
<!-- If user does NOT have admin permissions -->
<apex:outputPanel rendered="{!!$Permission.AdminPermission}">
    <apex:outputPanel layout="block">Record# {!record.Id}</apex:outputPanel>
</apex:outputPanel>

When the page first loads this works exactly as expected but then when I rerender the section that contains this portion of markup the permission that once worked (granting the link) is now false (showing just the text). If I refresh the page I again have the admin link.

Appreciate any feedback, thanks!