Skip to main content
Hi All,

I am a newbie to Salesforce .

I am trying to get input from user on Visualforce page for entering Custom object's records.

Custom Object : Merchandise_c

Apex :

<apex:page controller="Merchandise_Input" >

  <apex:form >

  <apex:inputText value="{!Name}" />

  <apex:commandButton value="save" action="{!save}"/>

  

  </apex:form>

</apex:page>

Controller

public with sharing class Merchandise_Input {

public String Name { get; set; }

    public void save() {

   //Merchandise_c Mer = new Merchandise_c();

    Merchandise_c.Name = 'Laptop';

       }}

Tried to get input on save button cant succeded so tried to hard code it .

Getting error :

Error: Merchandise_Input Compile Error: Variable does not exist: Merchandise_c.Name at line 6 column 5
5 respostas
  1. 6 de jul. de 2015, 18:57
    i have hard coded it like mer.Name = 'test'; but its not replicating in custom object record