While saving the vf page I am getting this error:Invalid character in identifier: getUsers__c.How to resolve this?

VF page:

<apex:page controller="createUsers">
  <apex:sectionHeader title="Registration Form" />
      <apex:form >
          <apex:pageBlock >
              <apex:pageBlockSection columns="1" showHeader="true" title="Personal Details">
                  <apex:inputField value="{!Users__c.Name}"/>
                  <apex:inputField value="{!Users__c.Contact_No__c}"/>
                  <apex:inputField value="{!Users__c.Email__c}"/>
                  <apex:inputField value="{!Users__c.URL__c}"/>

              <apex:pageblockButtons >
                  <apex:commandButton value="Submit" action="{!saveDetails}"/>


public class createUsers {

    public Users__c user{get;set;}
    //public String userInfo{get;set;}
    public createUsers()
        user = new Users__c();
    public PageReference saveDetails() {
        insert user;
        return null;


With the controller you have it should be the variable name {!user. not {!Users__c. in the page. When you use a standard controller the variable defaults to the type name but here you have picked the variable name. So:

              <apex:inputField value="{!user.Name}"/>
              <apex:inputField value="{!user.Contact_No__c}"/>
              <apex:inputField value="{!user.Email__c}"/>
              <apex:inputField value="{!user.URL__c}"/>

(I'm somewhat guessing that the page is trying to generate a getter call for the variable name and for your code when the getter name is created from Users__c it is invalid.)

Note that for what you have so far you could just use a standard controller. If you want to add more logic than the standard controller supports, you can also then add in a controller extension.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.