0

I have problem with writing values to custom object in VF controller whitch i include to apex:page. I can´t see box to write values in my apex:form. I have apex:inputfield, but i can only see it´s title, not box to write values. I have form in VF component and using custom controller. Can any help my solve this problem please?

Here is my code:

    <apex:component controller="TsCreateNewRecord">
    <apex:form id="formId">
        <apex:pageBlock title="insert record" mode="edit">
        <apex:pageBlockSection id="pageBlockSection">
            <apex:inputField value="{!EmpTsh.TS_Date__c}" required="false" type="date"/>
            <apex:inputText value="{!EmpTsh.TS_Comment__c}" required="false"/>
            <apex:inputField value="{!EmpTsh.TS_Value__c}" required="false"/>
            <apex:inputField value="{!EmpTsh.Project__c}" required="false"/>
            <apex:inputText id="theTextInput"/>
        </apex:pageBlockSection>
        <apex:pageBlockButtons >
            <apex:commandButton action="{!addNewRecord}" value="Save" />        
        </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>

and here is controller:

public class TsCreateNewRecord  {

public Employee_Timesheet__c EmpTsh { get; set; }

public TsCreateNewRecord()
{
    EmpTsh = new Employee_Timesheet__c();
}

public PageReference addNewRecord()
{
    insert EmpTsh;
    return null;
}

}

But i only see: enter image description here

  • 1
    Can u make sure these fields are not Read Only? – Ayub May 22 '18 at 8:55
  • Yes, i make sure and they are not Read-Only. The have only checked Visible checkbox for all Profiles – Marek May 22 '18 at 13:31
  • try taking the "type=" out of the inputField - that stuff is automatically done when using inputField - see if that takes care of your issue. – Ronnie May 23 '18 at 1:58
  • also since you're doing DML - you should return a new page reference instead of just a null - returning null doesn't allow it to commit - using a new page reference with "setRedirect(true)" will commit your input as well. – Ronnie May 23 '18 at 1:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.