You need to sign in to do that
Don't have an account?
Helen Y.
VF: How to render different outputlabel name in a repeat tage?
Hi,
I got lost here, so my work is to give several labels each a differernt name.
Till now, all upload attachment buttons with one name "Upload Vehicle Photo" in front:
<apex:repeat value="{!newAttachments}" var="att" >
<apex:pageBlockSectionItem >
<apex:outputLabel value="Upload Vehicle Photo"/>
<apex:inputfile value="{!att.body}" filename="{!att.Name}" />
</apex:pageBlockSectionItem>
<apex:commandlink value="Upload" action="{!insertatt}" styleClass="btn" style="padding:1px 10px 2px 5px; text-decoration:none;">
<apex:param name="attNameAdd" value="{!att.id}" assignTo="{!attNameAdd}"/>
</apex:commandlink>
</apex:repeat>
But now I need to revise the name from "Upload Vehicle Photo" to:
-- "Upload Vehicle Photo" for first row;
-- "Upload Old Photo" for second row;
-- "Upload New Photo" for third row.
It looks like have to revise the passing value from my controller to the page, but cannot figure it out.
Any help will be appreciated!
I got lost here, so my work is to give several labels each a differernt name.
Till now, all upload attachment buttons with one name "Upload Vehicle Photo" in front:
<apex:repeat value="{!newAttachments}" var="att" >
<apex:pageBlockSectionItem >
<apex:outputLabel value="Upload Vehicle Photo"/>
<apex:inputfile value="{!att.body}" filename="{!att.Name}" />
</apex:pageBlockSectionItem>
<apex:commandlink value="Upload" action="{!insertatt}" styleClass="btn" style="padding:1px 10px 2px 5px; text-decoration:none;">
<apex:param name="attNameAdd" value="{!att.id}" assignTo="{!attNameAdd}"/>
</apex:commandlink>
</apex:repeat>
But now I need to revise the name from "Upload Vehicle Photo" to:
-- "Upload Vehicle Photo" for first row;
-- "Upload Old Photo" for second row;
-- "Upload New Photo" for third row.
It looks like have to revise the passing value from my controller to the page, but cannot figure it out.
Any help will be appreciated!
Like this:
Hope that helps,
Clint
[Error] Error: Incorrect number of parameters for function 'IF()'. Expected 3, received 2
<apex:pageBlock title="Upload Images" >
<apex:pageBlockSection >
<apex:variable value="0" var="index"/> <!-- initialize the variable to 1 -->
<apex:repeat value="{!newAttachments}" var="att" >
<apex:pageBlockSectionItem >
<apex:outputLabel for="activationCounter" value="Upload {!IF(VALUE(index) = 0, "Vehicle", IF(VALUE(index) = 1, "Old", IF(VALUE(index) = 2, "New",(IF(VALUE(index) = 3, "One", (IF(VALUE(index) = 4, "TWO", "Three")))))))} Photo" />
<apex:outputPanel >
<!-- change the second word of the label depending on the variable -->
<apex:inputfile value="{!att.body}" filename="{!att.Name}" id="activationCounter" />
<apex:commandlink value="Upload" action="{!insertatt}" styleClass="btn" style="padding:1px 10px 2px 5px; text-decoration:none;">
<apex:param name="attNameAdd" value="{!att.id}" assignTo="{!attNameAdd}"/>
</apex:commandlink>
</apex:outputPanel>
</apex:pageBlockSectionItem>
<apex:variable var="index" value="{!VALUE(index) + 1}"/> <!-- increment the variable by 1 -->
</apex:repeat>
hmm, i need more spaces between two buttons Choose File and Upload, any suggestion?
As for the changes you've made to the VF page, apex:pageBlockSectionItems work best when there are only 2 elements in them. Your apex:outputPanel is just placing a <span> tag around its contents.
Try using an apex:panelGrid like this.