You need to sign in to do that
Don't have an account?
Esther Merc
visualforce Error: RegistrationController Compile Error: Unexpected token ','. at line 25 column 65
Hi Guys ,
After filling Registration form when Submit is clicked should be take to Welcome Page and Information in Form should be saved to Registration__c that I created
But got this Error
Error: RegistrationController Compile Error: Unexpected token ','. at line 25 column 65
Visualforce Page
apex:page controller = "RegistrationController">
<apex:sectionHeader title = "Registration Form" />
<apex:form>
<apex:pageBlock>
<apex:pageBlockButtons location="bottom" >
<apex:commandButton value="Submit" action="{!WelcomePage}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection> collapsible = "false" columns="1">
<apex:pageMessages> </apex:pageMessages>
<apex:inputText label="Name" value="{!reg.Name}" />
<apex:inputText label="Username" />
<apex:inputSecret label="Password" />
<apex:inputSecret label="Confirm Password" />
<apex:inputText label="SecurityQuestion" size="1"> />
<apex:selectOptions>
value="{!SecurityQuestion}">
</apex:selectOptions>
</selectList>
<apex:inputText label="Answer"/>
</apex:pageBlockSection>
</apex:pageblock>
</apex:form>
</apex:page>
Controller Class
ublic class RegistrationController {
Public pageReference RedirectToLoginPage() {
return null;
}
Public RegistrationController() {
reg = new Registration__c();
}
public Registrationcontroller(ApexPages.StandardController controller) {
}
Public PageReference RedirectToFinalPage() {
pageReference pg = new pageReference ('/apex/WelcomePage');
return pg.setRedirect(true);
}
public pageReference welcomePage(){
if (string.isBlank (reg.Name__c)) {
ApexPages.addMessage(new ApexPages.Message.severity.ERROR,'Enter Username!!'));
return null;
}
insert reg;
pageReference pg = new pageReference ('/apex/WelcomePage');
return pg.setRedirect(true);
}
public pageReference loginPage(){
pageReference pg = new pageReference ('/apex/LogingPage');
return pg.setRedirect(true);
}
public pageReference SignupPage() {
pageReference pg = new pageReference ('/apex/LogingPage');
return pg.setRedirect(true);
}
Public pageReference resetPassword(){
pageReference pg = new pageReference ('/apex/ResetPasswordPage');
return pg.setRedirect(true);
}
Public Registration__c reg {get;set;}
Public List<schema.PicklistEntry>
getSecurityList= Registration__c.Security_Question__c.getDescribe().getPicklistValues();
for(schema.PicklistEntry securityQn : getSecurityList) {
listSecurityQuestions.add(new SelectOption(securityQn.getLabel()));
}
Return listSecurityQuestions;
}
Public void sendEmail() {
Messaging.SingleEmailMessage eMailObj = new Messaging.SingleEmailMessage();
String[] ToAddress = new String [] {'esther@gmail.com '};
eMailObject.setToAddresses(ToAddress);
String subject = 'New Password';
eMailObject.setSubject(subject);
String mailBody = '<b> New Password was created <b>';
eMailObject.setHtmlBody(mailBody);
Messaging.sendEmail( new Messaging.SingleEmailMessage[]eMailObj});
}
}
After filling Registration form when Submit is clicked should be take to Welcome Page and Information in Form should be saved to Registration__c that I created
But got this Error
Error: RegistrationController Compile Error: Unexpected token ','. at line 25 column 65
Visualforce Page
apex:page controller = "RegistrationController">
<apex:sectionHeader title = "Registration Form" />
<apex:form>
<apex:pageBlock>
<apex:pageBlockButtons location="bottom" >
<apex:commandButton value="Submit" action="{!WelcomePage}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection> collapsible = "false" columns="1">
<apex:pageMessages> </apex:pageMessages>
<apex:inputText label="Name" value="{!reg.Name}" />
<apex:inputText label="Username" />
<apex:inputSecret label="Password" />
<apex:inputSecret label="Confirm Password" />
<apex:inputText label="SecurityQuestion" size="1"> />
<apex:selectOptions>
value="{!SecurityQuestion}">
</apex:selectOptions>
</selectList>
<apex:inputText label="Answer"/>
</apex:pageBlockSection>
</apex:pageblock>
</apex:form>
</apex:page>
Controller Class
ublic class RegistrationController {
Public pageReference RedirectToLoginPage() {
return null;
}
Public RegistrationController() {
reg = new Registration__c();
}
public Registrationcontroller(ApexPages.StandardController controller) {
}
Public PageReference RedirectToFinalPage() {
pageReference pg = new pageReference ('/apex/WelcomePage');
return pg.setRedirect(true);
}
public pageReference welcomePage(){
if (string.isBlank (reg.Name__c)) {
ApexPages.addMessage(new ApexPages.Message.severity.ERROR,'Enter Username!!'));
return null;
}
insert reg;
pageReference pg = new pageReference ('/apex/WelcomePage');
return pg.setRedirect(true);
}
public pageReference loginPage(){
pageReference pg = new pageReference ('/apex/LogingPage');
return pg.setRedirect(true);
}
public pageReference SignupPage() {
pageReference pg = new pageReference ('/apex/LogingPage');
return pg.setRedirect(true);
}
Public pageReference resetPassword(){
pageReference pg = new pageReference ('/apex/ResetPasswordPage');
return pg.setRedirect(true);
}
Public Registration__c reg {get;set;}
Public List<schema.PicklistEntry>
getSecurityList= Registration__c.Security_Question__c.getDescribe().getPicklistValues();
for(schema.PicklistEntry securityQn : getSecurityList) {
listSecurityQuestions.add(new SelectOption(securityQn.getLabel()));
}
Return listSecurityQuestions;
}
Public void sendEmail() {
Messaging.SingleEmailMessage eMailObj = new Messaging.SingleEmailMessage();
String[] ToAddress = new String [] {'esther@gmail.com '};
eMailObject.setToAddresses(ToAddress);
String subject = 'New Password';
eMailObject.setSubject(subject);
String mailBody = '<b> New Password was created <b>';
eMailObject.setHtmlBody(mailBody);
Messaging.sendEmail( new Messaging.SingleEmailMessage[]eMailObj});
}
}
Can you rewrite the last method as below.
Let me know if any error on it.
The total class looks as below.
If this solution help, Please mark it as best answer.
Thanks,
All Answers
There was an extra ) at the end of 25th line which caused the issue.
Can you check saving it as above .
Let me know if you need any help on it.
If this solution helps, Please mark it as best answer.
Thanks,
Error: RegistrationController Compile Error: Missing '<EOF>' at 'for' at line 60 column 3
Controller Class
public class RegistrationController {
Public pageReference RedirectToLoginPage() {
return null;
}
Public RegistrationController() {
reg = new Registration__c();
}
public Registrationcontroller(ApexPages.StandardController controller) {
}
Public PageReference RedirectToFinalPage() {
pageReference pg = new pageReference ('/apex/WelcomePage');
return pg.setRedirect(true);
}
public pageReference welcomePage(){
if (string.isBlank (reg.Name__c)) {
ApexPages.addMessage(new ApexPages.Message(Apexpages.Severity.ERROR,'Enter Username!!'));
return null;
}
insert reg;
pageReference pg = new pageReference ('/apex/WelcomePage');
return pg.setRedirect(true);
}
public pageReference loginPage(){
pageReference pg = new pageReference ('/apex/LogingPage');
return pg.setRedirect(true);
}
public pageReference SignupPage() {
pageReference pg = new pageReference ('/apex/LogingPage');
return pg.setRedirect(true);
}
Public pageReference resetPassword(){
pageReference pg = new pageReference ('/apex/ResetPasswordPage');
return pg.setRedirect(true);
}
Public Registration__c reg {get;set;}
Public List<schema.PicklistEntry>
getSecurityList= Registration__c.Security_Question__c.getDescribe().getPicklistValues();
}
for(schema.PicklistEntry securityQn:getSecurityList) {
listSecurityQuestions.add(new SelectOption(securityQn.getValue(), securityQn.getLabel()));
Return listSecurityQuestions;
}
}
Public void sendEmail() {
Messaging.SingleEmailMessage eMailObj = new Messaging.SingleEmailMessage();
String[] ToAddress = new String [] {'esther@gmail.com '};
eMailObject.setToAddresses(ToAddress);
String subject = 'New Password';
eMailObject.setSubject(subject);
String mailBody = '<b> New Password was created <b>';
eMailObject.setHtmlBody(mailBody);
Messaging.sendEmail( new Messaging.SingleEmailMessage[]eMailObj});
}
}
Can you check the below code and let me know if you are facing issues.
Thanks,
Error: RegistrationController Compile Error: Missing '{' at 'eMailObj' at line 82 column 60
Can you rewrite the last method as below.
Let me know if any error on it.
The total class looks as below.
If this solution help, Please mark it as best answer.
Thanks,
Error: RegistrationController Compile Error: Variable does not exist: listSecurityQuestions at line 61 column 9