function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Marcela SanchezMarcela Sanchez 

as I can pass the name of travel in the Field?

I have a problem with my code, and I can move or drag the name of the travel to my window "New Expenses", what I did here was to make a window where you can add multiple Expenses in one window, but in my code if I put <apex:inputfield value="{!Expenses__c.Travels__c}" required="true"/> drag me the name of the travel but when I get the expenditure does not keep in my travel.
As I can do to have the name of the travel there and save me the cost I do?

This is my code:

<apex:page StandardController="Expenses__c" extensions="AddExpenses" id="thePage" docType="html-5.0">

<apex:form >
<apex:sectionheader title="{!$ObjectType.Expenses__c.label} Edit" subtitle="{!IF(ISNULL(Expenses__c.Name), 'New Expenses',Expenses__c.Name)}"/>

<apex:pageblock id="pb1">
<apex:repeat value="{!lstInner}" var="e1" id="therepeat">
<apex:pageblock id="pb" title="New Expenses">
    <apex:pageBlockButtons >
        <apex:commandbutton value="Add" action="{!Add}" rerender="pb1"/>
        <apex:commandbutton value="Save" action="{!Save}"/>
        <apex:commandButton value="Reset" status="idStatus" onclick="this.form.reset();return false;"/>
        <apex:commandbutton value="Back to travel" action="{!Cancel}"/> 

        <apex:outputpanel >
                <apex:pageblocksection title="Information" showheader="true" columns="2">
                <apex:inputfield value="{!e1.acct.Travels__c}" required="true"/>
                <apex:pageblocksectionitem />
                    <apex:pageblocksection title="Relation" showheader="true" columns="3">
                    <apex:inputfield value="{!e1.acct.Parent_Customer__c}" required="false"/> 
                    <apex:inputfield value="{!e1.acct.Corporate__c}" required="false"/>
                    <apex:inputfield value="{!e1.acct.Suspect__c}" required="false"/>
                    <apex:inputfield value="{!e1.acct.Campaign__c}" required="false"/>
                    <apex:inputfield value="{!e1.acct.Prospect__c}" required="false"/>
                    <apex:pageblocksectionitem />
                <apex:pageblocksection title="Concept & Monetary" showheader="true" columns="5">
                    <apex:inputfield value="{!e1.acct.Name}" required="true"/>
                    <apex:inputfield value="{!e1.acct.Currency__c}" required="false"/>
                    <apex:inputfield value="{!e1.acct.Date__c}" required="false"/>
                    <apex:inputfield value="{!e1.acct.Amount__c}" required="true"/>
                    <apex:inputfield value="{!e1.acct.Entry__c}" required="false"/>
                    <apex:inputfield value="{!e1.acct.IVA__c}" required="false"/>
                    <apex:inputfield value="{!e1.acct.Entry_Type__c}" required="false"/>
                    <apex:inputfield value="{!e1.acct.Tips__c}" required="false"/>
                    <apex:inputfield value="{!e1.acct.Other_specify__c}" required="false"/>
                    <apex:inputfield value="{!e1.acct.Billed_To__c}" required="false"/>
                    <apex:inputfield value="{!e1.acct.Payment_Method__c}" required="false"/>
                    <apex:inputfield value="{!e1.acct.Invoice__c}" required="false"/>
                    <apex:inputfield value="{!e1.acct.Description__c}" required="false"/>
                    <apex:pageBlockSectionItem >



                <apex:pageblocksection title="Detailed Transport (If Apply)" showheader="true" columns="3">
                    <apex:inputfield value="{!e1.acct.Taxi_from__c}" required="false"/>
                    <apex:inputfield value="{!e1.acct.Taxi_to__c}" required="false"/>


///////////////// Controller//////////////////

public class AddExpenses {

 public List<Expenses__c>lstAcct = new List<expenses__c>();
    public List<innerClass> lstInner
    {   get;set;    } 
    public String selectedRowIndex  
    public Integer count = 1;
    public PageReference Save()
    PageReference pr = new PageReference('/apex/Expense');
        for(Integer j = 0;j<lstInner.size();j++)
        insert lstAcct;
      return pr;
   public void Add()
        count = count+1;
    public void addMore()
        innerClass objInnerClass = new innerClass(count);
    public AddExpenses(ApexPages.StandardController ctlr)
        lstInner = new List<innerClass>();
        selectedRowIndex = '0';
    public class innerClass
        public String recCount
        public expenses__c acct 
        public innerClass(Integer intCount)
            recCount = String.valueOf(intCount);        
          acct = new expenses__c();


James LoghryJames Loghry

What exactly are you asking, and what exactly is the issue you are having here?  It's not clear at all what your ask is.

Please reply with a better description.  Also, when you post any code or markup, please use the code format (< >) button.  This button helps format the code and allows us to copy and paste the code for our solutions, if necessary.

Thank you.