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
Chris987654321Chris987654321 

Edit a page in Customer Portal



public class RasmussenEnrollmentClass{

EA__c enrollment;

public RasmussenEnrollmentClass() {

}

public EA__c getEnrollment() {
if (enrollment==null) {
enrollment= [select Date_of_Birth__c, Phone_Number__c, Secondary_Phone__c, Address_1__c,
Address_2__c, City__c, Country__c, Email__c,Last_Legal_Name__c, First_Legal_Name__c,
Maiden_Name__c,Phone__c,Start_Date__c,Start_Date_2__c,Degree_Applied_For__c,
Program_Emphasis__c, State__c,Zipcode__c, Social_Security_Number__c,
Name_of_Institution__c,Name_of_Institution_2__c,Name_of_Institution_3__c,Name_of_Institution_4__c,Name_of_Institution_5__c,
Dates_Attended__c,Dates_Attended_2__c,Dates_Attended_3__c,Dates_Attended_4__c,Dates_Attended_5__c,
Degree_Received__c,Received_2__c,Received_3__c,Received_4__c,Received_5__c FROM EA__c WHERE Student_Name__c=:userinfo.getuserid()];
}

return enrollment;
}

public PageReference save() {

try {

update enrollment;
}

catch(System.DMLException e) {
ApexPages.addMessages(e);
return null;
}

return null;
}


}

 

VF Page

 

<apex:page sidebar="false" controller="RasmussenEnrollmentClass">
<center>
<table width="75%" border="0">
<tr>
<td>

<apex:sectionHeader title="Rasmussen Enrollment Agreement" subtitle="Page 1"/>
<apex:form >
<apex:pageBlock helpTitle="Click for help" helpUrl="http://www.google.com" title="ENROLLMENT INFORMATION" mode="edit" >
<apex:pageBlockButtons >
<apex:commandButton action="{!Save}" value="Save"/>
</apex:pageBlockButtons>

<apex:pageBlockSection columns="2">

<apex:inputField id="FName" value="{!enrollment.First_Legal_Name__c}" required="FALSE"/>
<apex:inputField id="LName" value="{!enrollment.Last_Legal_Name__c}" required="FALSE"/>
<apex:inputField id="SSN" value="{!enrollment.Social_Security_Number__c}" required="FALSE"/>
<apex:inputField id="DOB" value="{!enrollment.Date_of_Birth__c}" required="FALSE"/>
<apex:inputField id="Phone" value="{! enrollment.Phone_Number__c}" required="FALSE"/>
<apex:inputField id="Phone2" value="{! enrollment.Secondary_Phone__c}" required="FALSE"/>
<apex:inputField id="Address1" value="{! enrollment.Address_1__c}" required="FALSE"/>
<apex:inputField id="Address2" value="{! enrollment.Address_2__c}" required="FALSE"/>
<apex:inputField id="City" value="{! enrollment.City__c}" required="FALSE"/>
<apex:inputField id="Country" value="{! enrollment.Country__c}" required="FALSE"/>
<apex:inputField id="Email" value="{! enrollment.Email__c}" required="FALSE"/>
<apex:inputField id="Maiden" value="{! enrollment.Maiden_Name__c}" required="FALSE"/>
<apex:inputField id="Phone3" value="{! enrollment.Phone__c}" required="FALSE"/>
<apex:inputField id="State" value="{! enrollment.State__c}" required="FALSE"/>
<apex:inputField id="Zip" value="{! enrollment.Zipcode__c}" required="FALSE"/>

</apex:pageBlockSection>
</apex:pageBlock>



</apex:form>

</td>
</tr>
</table>
</center>

</apex:page>

 

 

I created a VF Page for the Customer Portal. When a customer logs in, it pulls information in Salesforce based on their user id.

 

I want to allow the customer to edit their information and save it. 

 

My issue is it is saving changes to the  First_Legal_Name__c and Last_Legal_Name__C...However none of theother fields are saving. Am I going about this wrong? Do I need to have a View page and an Edit page like how Salesforce does it on their objects?

 

Thank you for any help you may have.

 

 

Best Answer chosen by Admin (Salesforce Developers) 
mikefmikef

If you are not using the extension for anything then don't use it.

Just use the standard controller.

Change the save button's action to lower case save, {!save}.

All Answers

mikefmikef

You are not changing any values in your enrollment object once you have it in memory

Use the EA__c standard controller, then you won't have to create your own save method and what you have in your page should work.

The docs are a good place to start for example of how to use a standard controller.

 

 

Chris987654321Chris987654321

Thanks, but it still does not save any fields except first_legal_name__c and last_legal_name__c.

 

I changed the page tag to the following:

<apex:page sidebar="false" standardController="EA__c" extensions="RasmussenEnrollmentClass">

 

Isn't it strange that it will update the first_legal_name__c and last_legal_name__c?

 

I thought maybe there were some read-only permissons on the other fields but I none of them are read-only.

 

mikefmikef

Look at the FLS for all the fields, they could be set to read only for your profile.

If FLS is set to read only then yes you would expect this behavior.

Chris987654321Chris987654321
I rechecked and nothing in the FLS is set to read-only.
mikefmikef

If you are not using the extension for anything then don't use it.

Just use the standard controller.

Change the save button's action to lower case save, {!save}.

This was selected as the best answer