I have 3 same sections in visualforce page. Users will have 3 of this section minimal to fill out. But what i want to make is button on which i will add new section, same as others. Because user may need 20 of this section, maybe 30. But some of them maybe need only 3. I don't want to take a lot of space, so i want to make some button '+' on which i will be available to add as much sections as i want. Can someone help me? ( image)
1 Answer
You can output an apex:pageBlockSection
per object, starting with 3 created in your controller and then having a button that adds one at a time and re-renders the page block to show the new additions:
<apex:page controller="...">
<apex:form >
<apex:pageBlock >
<apex:repeat value="{!contacts}" var="c">
<apex:pageBlockSection title="Authorized Person">
<apex:outputField value="{!c.Name}"/>
...
</apex:pageBlockSection>
</apex:repeat>
</apex:pageBlock>
</apex:form>
</apex:page>
-
-
@IgorStosic See these examples salesforce.stackexchange.com/search?q=apex%3AcommandButton.– Keith CJan 22, 2017 at 12:20