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
SATZSATZ 

Custom Login Page on Visualforce

Hi All,

 I am created custom visualforce page . Shows error for passing password value to controller.

 

Error: Read only property 'PackageTesting.login.password' 

 

Note : its working without that password field .

 

 Page:

----------

<apex:page showHeader="false" sidebar="false" controller="login">
<apex:form >
<br><apex:image value="{!$Resource.AnimFlag}" width="100" height="100"/></br>
<apex:pageBlock >
<apex:pageBlockSection title="Account New">
<br>User Name<apex:inputText value="{!username}"/></br>
<br>Pass Word<apex:inputText value="{!password}"/></br>
<apex:commandButton value="Submit" onclick="{!login}"/>
<apex:outputLink > ForgetPassword </apex:outputLink>
<apex:outputLink value="https://packagetesting.ap1.visual.force.com/apex/AccountDisplay"> Create new Account</apex:outputLink>
</apex:pageBlockSection>
</apex:pageBlock>

</apex:form>
</apex:page>

 

 

Controler

----------------

public with sharing class login{

String username;
String password;

public String getusername() {return username;}
public void setusername(String un){this.username=un;}
public String getpassword() {return password;}
public void getpassword(String pw){this.password=pw;}

public String getLogin(){
List<Account> a = [select id from Account where Name like:username+'%'and PackageTesting__Password__c like:password+'+'];
if(a.isEmpty()){
some Logic goes here;
}
else{
some logic goes here;
}
return null;
}

 

Plz help me 

Regards

Sathish

 

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

You don't have a setpassword method, so password is considered a read only property.

 

public String getpassword() {return password;}
public void getpassword(String pw){this.password=pw;}

 change the second mehtod to setpassword(string pw) and all will be well.

 

 

All Answers

bob_buzzardbob_buzzard

You don't have a setpassword method, so password is considered a read only property.

 

public String getpassword() {return password;}
public void getpassword(String pw){this.password=pw;}

 change the second mehtod to setpassword(string pw) and all will be well.

 

 

This was selected as the best answer
Ashmi PatelAshmi Patel
what should be the logic in IF ELSE  statement??...