You need to sign in to do that
Don't have an account?
Avula Reddy
Should reoccur the same fields on clicking 'ADD' button on the same record page
Hi,
I want the fields in the record page to be repeated in the same page on clicking the 'Add' button. Once clicked on save all the added field values should be displayed.
Below is what I need. Once I clicked on 'Add New ItemRequest', the fields should be repeated below to the existing one and once clicked on Save, all the requests should be saved under singlr Item Request Name.
RR
I want the fields in the record page to be repeated in the same page on clicking the 'Add' button. Once clicked on save all the added field values should be displayed.
Below is what I need. Once I clicked on 'Add New ItemRequest', the fields should be repeated below to the existing one and once clicked on Save, all the requests should be saved under singlr Item Request Name.
RR
i've achieved the field sets repeating by by placing the fields in field set and using <apex:repeat> tag but each time when I click the 'Add New ItemRequest' button I want it the method to be invoked and display the fields again....
I thing I'm missing a for loop in method to keep rendering the pageblock. Can you please help in achieving it?
Below isthe code.
<apex:page standardController="Item_Request__c" extensions="NewitemRequest">
<apex:form >
<apex:pageBlock rendered="{!show}">
<apex:pageBlockSection title="New item request">
<apex:inputField value="{!Item_Request__c.Item_Code__c}"/>
<apex:inputField value="{!Item_Request__c.Priority__c}"/>
<apex:inputField value="{!Item_Request__c.Quantity__c}"/>
<apex:inputField value="{!Item_Request__c.Status__c}"/>
<apex:inputField value="{!Item_Request__c.Business_Justification__c}"/>
</apex:pageBlockSection>
<apex:pageBlockButtons location="bottom">
<apex:commandButton value="Add new Item Req" action="{!showfields}">
</apex:commandButton>
</apex:pageBlockButtons>
</apex:pageBlock>
<apex:pageblock rendered="{!hide}" >
<apex:pageBlockSection>
<apex:repeat value="{!$Objecttype.Item_Request__c.fieldsets.AddNewItemRequest}" var="ir">
<apex:inputField value="{!Item_Request__c[ir]}"/>
</apex:repeat>
</apex:pageBlockSection>
<apex:pageBlockButtons location="bottom">
<apex:commandButton value="Add new Item Req" action="{!showfields}"/>
<apex:commandButton value="Save" action="{!save}"/>
</apex:pageBlockButtons>
</apex:pageblock>
</apex:form>
</apex:page>
Controller:
---------------
public class NewitemRequest {
public boolean show{get;set;}
public boolean hide{get;set;}
public NewitemRequest(ApexPages.StandardController controller) {
show=true;
hide=false;
}
public void showfields()
{
show=true;
hide=true;
}
}
NB: new line won't be added until you will fill in the name(required field for account)
Class:
VF:
Valerijs