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
Nam Ho KimNam Ho Kim 

Trailhead Challenge: Inputting Data Using Forms

Hi, 

I have a code written in Visualforce - developer console page, but it's not displaying any preview nor allowing me to pass the challenge -  I assume that I've made some error on this..
 
The task given for this challenge as follows:

Create a Visualforce form which inserts a basic Contact record

Using the Visualforce apex:form component, create a page which will insert a Contact record based on First Name, Last Name and Email. After submitting the form, the user should be redirected to detail page of the new Contact record.The page must be named 'CreateContact'.
  • It must reference the Contact standard controller.
  • It must use a Visualforce apex:form component.
  • It must have an apex:inputField component bound to the Contact First Name.
  • It must have an apex:inputField component bound to the Contact Last Name.
  • It must have an apex:inputField component bound to the Contact Email.
  • It must have an apex:commandButton component that uses the 'save' method from the standard controller.
Please help me to resolve this problem.. Thanks in advance

User-added image
Best Answer chosen by Nam Ho Kim
KaranrajKaranraj
The issue seems like you didn't save the latest code but your are trying to preview the visualforce page with the old code. Just click CTRL+S to save your latest changes and then trying previewing the record. If everthing is looks fine, the submit the challenge

All Answers

KaranrajKaranraj
The issue seems like you didn't save the latest code but your are trying to preview the visualforce page with the old code. Just click CTRL+S to save your latest changes and then trying previewing the record. If everthing is looks fine, the submit the challenge
This was selected as the best answer
Sai chand BitraSai chand Bitra
<apex:page standardController="Contact">
    <apex:form>
    <apex:pageBlock title="Add contacts">
         <apex:pageBlockSection columns="1">
            <apex:inputField value="{! Contact.FirstName }"/>     
                <apex:inputField value="{! Contact.Lastname }"/>       
    <apex:inputField value="{! Contact.email }"/>       
            </apex:pageBlockSection>
        
        <apex:pageBlockButtons >
            <apex:commandButton action="{! save }" value="Save" />        
        </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Hope this will help you solve this trailhead. Please save couple of times before preview of the page

Thanks
Sai
shradha mhaskeshradha mhaske
<apex:page standardController="Contact">
    <h1>Contact Record</h1>
    <apex:form title="Insert Contact Record">
        <apex:pageBlock>
            <apex:pageBlockSection columns="1" title="Insert Contact Info">
        <apex:inputField label="Enter Name" value="{!Contact.FirstName}"/>
        <apex:inputField label="Last Name" value="{!Contact.LastName}"/>
        <apex:inputField value="{!Contact.Email}"/>
                <apex:commandButton action="{!Save}" value="Save" style="Save"/>
    </apex:pageBlockSection>
    
     </apex:pageBlock>
    </apex:form>
    
    
   
</apex:page>

 
Varalakshmi Niharika JaguVaralakshmi Niharika Jagu
Hi, please use the below code snippet to get 100% with your challenge!
 
<apex:page standardController="Contact">
    <h1>Create Contact</h1>
    <apex:form>
    	<apex:pageBlock title="Create Contact">
        	<apex:pageBlockSection columns="1">
            	<apex:inputField value="{! Contact.FirstName}"/>
                <apex:inputField value="{! Contact.LastName}"/>
                <apex:inputField value="{! Contact.Email}"/>
            </apex:pageBlockSection>
            <apex:pageBlockButtons>
            	<apex:commandButton action="{! save}" value="Save"/>
            </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
</apex:page>