• Fabian Paul 6
  • NEWBIE
  • 5 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 5
    Replies
public PageReference save() {

                PageReference p = null;
                if (this.qp == null || !'yyyy'.equals(this.qp)) {
                    p = Page.failure;
                    p.getParameters().put('error', 'noParam');
              } else {
                    try {
                        Lead newlead = new Lead(LastName=this.lastName,
                                                FirstName=this.firstName;
                                                Company=this.company,
                                                Email=this.email)
                        insert newlead;
                    } catch (Exception e) {
                        p = Page.failure;
                        p.getParameters().put('error', 'noInsert');
                   }

                }

                 

                if (p == null) {

                    p = Page.success;

                }
                         p.setRedirect(true);
                return p;
            }
Hello, I am just new to salesforce and cannot figure out why iam getting this error....and trying a lot and lots of searches....
So, this is my controller code...where i am declared List<> variable...

public class OnlineExamController 

    public static String selectedExam{get;set;}
    
    public List<OnlineExam__c> o{get;set;}
    
    public List<Integer> iter{get;set;}
    
    public OnlineExamController(ApexPages.StandardController stdController)
    {
        
    }
    
    public OnlineExamController(){}
    
    
    public  List<SelectOption> examName
    {
        get
        {
            examName=new List<SelectOption>();
            examName.add(new SelectOption('----None---','----None---'));
            examName.add(new SelectOption('DAV_401_EXAM','DAV_401_EXAM'));
            examName.add(new SelectOption('DAV_402_EXAM','DAV_402_EXAM'));
            examName.add(new SelectOption('DAV_403_EXAM','DAV_403_EXAM'));
            examName.add(new SelectOption('DAV_404_EXAM','DAV_404_EXAM'));
            
            return examName;
        }
        set;
    }
    
    public PageReference call()
    {
        system.debug(selectedExam);
        o=[Select Questions__c, A__c, B__c, C__c, D__c, E__c, Answer__c, Multiple__c, ExamName__c From OnlineExam__c];
        system.debug(o);
        iter=new List<Integer>{0,1};
        return null;
    }
}
Ad this one is my vf page code , just showing the part which is causing the error because the whole code is too big...to display...

<apex:page controller="OnlineExamController">
<apex:form>
   .
   .
   .
<div class="slds-form slds-form_stacked" style="display:block;">
            <div class="slds-form-element" style="width:100%; margin-top:5%;">
                <div style="float:left;">
                    <label class="slds-form-element__label" style="font-size:20px; margin-left:20px; text-align:left;">Question No.1</label> 
                </div>
                
                <div style="position:relative;float:left; width:70%; margin-left:10px">
                    <b style="font-size:20px;">
         (--PART--------<apex:repeat value="{!iter}" var="pos">
                            <apex:outputText  value="{!o.[pos].Questions__c}"/>
                        </apex:repeat>--------CAUSING ERROR---------)
                    </b>
                </div>

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

Thanks in advance.
i have a controller as'OnlineExamController' in which i have declared a variable ' o ' as shown below in controller code..


public class OnlineExamController 

    public Integer value{get;set;}
    public String selectedExam{get;set;}
    // public List<OnlineExam__c> o{get;set;}
    
    public OnlineExamController(ApexPages.StandardController stdController)
    {
        // oc = new OnlineExamController();
        
        
    }
    
    public OnlineExamController(){
        
        // ex=new ExamController(oc);
        
    }
    
    
    public  List<SelectOption> examName
    {
        get
        {
            examName=new List<SelectOption>();
            examName.add(new SelectOption('----None---','----None---'));
            examName.add(new SelectOption('DAV_401_EXAM','DAV_401_EXAM'));
            examName.add(new SelectOption('DAV_402_EXAM','DAV_402_EXAM'));
            examName.add(new SelectOption('DAV_403_EXAM','DAV_403_EXAM'));
            examName.add(new SelectOption('DAV_404_EXAM','DAV_404_EXAM'));
            
            return examName;
        }
        set;
    }
    
    public List<OnlineExam__c> o
    {
        get
        {
            try
            {
                o=new List<OnlineExam__c>();
                
                o=[Select Questions__c, A__c, B__c, C__c, D__c, E__c, Answer__c, Multiple__c, ExamName__c From OnlineExam__c Where ExamName__c=:selectedExam];
            }
            catch(Exception ex)
            {
                o=null;
                system.debug('object is null');
            }
            return o;
        }
        private set;
    }
    
    public void selectPage()
    {
        if(o[0].Multiple__c > 0)
        {
            value=1;   
        }
        else
        {
            value=0;
        }
    }
    
    public PageReference call()
    {
        system.debug(selectedExam);        
        return null;
    }
}

which is giving me an error on my vf page ExamPage2, this is my page code....

<apex:page controller="OnlineExamController">S
    <apex:form >
        <apex:slds />
        <div class="slds-p-top_xx-large">
            <div style="background-color:rgba(255,219,172,0.3);width:100%">
                <h1 style="font-size:40px;" align="center">DAV_403_EXAM</h1>
            </div>
            <div style="background-color:rgb(182,120,152);height:30%;width:80%;border-radius:10px; margin : 0 auto; margin-top:2%;">
                <br/><br/>
            </div>
            <!--<div style="backgroung-color:rgba(182,120,152,0.1);height:40%;width:100%">

</div>-->
            <div style="display:block; width:100%; float:right; text-align:right; margin-top:20px;">
                <b>Remaining Time</b>
            </div>
        </div>
               
        <style>
            
            .button {
            background-color: #4CAF50 !important; /* Green */
            border: none !important;
            color: white !important;
            padding: 12px 30px !important;
            text-align: center !important;
            
            display: inline-block !important;
            font-size: 15px !important;
            margin: 4px 2px !important;
            -webkit-transition-duration: 0.4s !important; /* Safari */
            transition-duration: 0.4s !important;
            cursor: pointer !important;
            -webkit-border-radius:10px !important;
            }
            
            .button1 {
            background-color: white !important; 
            color: black !important; 
            border: 2px solid #7f7fff !important;
            }
            
            .button1:hover {
            background-color: #4CAF50 !important;
            color: blue !important;
            }
        </style>
        
       
        <div class="slds-form slds-form_stacked" style="display:block;">
            <div class="slds-form-element" style="width:100%; margin-top:5%;">
                <div style="float:left;">
                    <label class="slds-form-element__label" style="font-size:20px; margin-left:20px; text-align:left;">Question No.1</label> 
                </div>
                
                <div style="position:relative;float:left; width:70%; margin-left:10px">
----------------- <b style="font-size:20px;">{!o[0].Questions__c}</b> --------------(error part)-----------------------------------
                </div>
                
                <div style="position:relative;float:left; width:70%; margin-left:10px">
                    <b style="font-size:20px;">Note:-</b> <text style="font-size:20px;">Multiple Answers Can be Correct</text>
                </div>
                
                <div style="float:right; width:5%;">
                    <span style="background:blue; text-style:bold; text-decoration:underline; color:white; padding:5px; font-size:15px; border-radius:10px">
                        Marks
                    </span>
                </div>
            </div>
            <div style="float:left; width:100%" id="checkbox_style">                                
                <fieldset class="slds-form-element" >
                    <div class="slds-form-element_control">
                        <span class="slds-checkbox" style="margin-left:250px;margin-top:20px">
                            <input type="checkbox" name="options" id="checkbox-1" value="on" />
                            <label class="slds-checkbox__label" for="checkbox-1">
                                <span class="slds-checkbox_faux"></span>
                                <span class="slds-form-element__label">DVD</span>
                            </label>
                        </span>
                        <span class="slds-checkbox" style="margin-left:250px;margin-top:20px">
                            <input type="checkbox" name="options"  id="checkbox-2" value="on" />
                            <label class="slds-checkbox__label" for="checkbox-2">
                                <span class="slds-checkbox_faux"></span>
                                <span class="slds-form-element__label">Speaker</span>
                            </label>
                        </span>
                        <span class="slds-checkbox" style="margin-left:250px;margin-top:20px">
                            <input type="checkbox" name="options" id="checkbox-3" value="on" />
                            <label class="slds-checkbox__label" for="checkbox-3">
                                <span class="slds-checkbox_faux"></span>
                                <span class="slds-form-element__label">Monitor</span>
                            </label>
                        </span>
                        <span class="slds-checkbox" style="margin-left:250px;margin-top:20px">
                            <input type="checkbox" name="options" id="checkbox-4" value="on" />
                            <label class="slds-checkbox__label" for="checkbox-4">
                                <span class="slds-checkbox_faux"></span>
                                <span class="slds-form-element__label">Mouse</span>
                            </label>
                        </span>
                        <span class="slds-checkbox" style="margin-left:250px;margin-top:20px">
                            <input type="checkbox" name="options" id="checkbox-5" value="on" />
                            <label class="slds-checkbox__label" for="checkbox-5">
                                <span class="slds-checkbox_faux"></span>
                                <span class="slds-form-element__label">Printer</span>
                            </label>
                        </span>
                    </div>
                </fieldset>
            </div>
                        
        </div>
        
        <hr size="0" style = "visibility : hidden"/>
        
        <div class="slds-form-element" style="display:block;margin-top:10px">
            <b style="font-size:20px;margin-top:20px;">Mark as Unread</b>
            <span class="slds-checkbox" style="margin-left:50px;">
                <input type="checkbox" name="options" id="checkbox-6" value="on" />
                <label class="slds-checkbox__label" for="checkbox-6">
                    <span class="slds-checkbox_faux"></span>
                    <!---       <span class="slds-form-element__label">Checkbox Label</span>--->
                </label>
            </span>
        </div> 
        
        <div class="slds-form-element" style="margin-top:30px;margin-left:200px;">
            <apex:commandButton value="< Previous" styleClass="button button1" />
            <apex:commandButton value="Next >" styleclass="button button1" style="margin-left:10px;"/>
            <apex:commandButton value="Review" styleClass="button button1" style="margin-left:10px;"/>
            <apex:commandButton value="Submit"  onclick="onSubmit" styleClass="button button1" style="margin-left:10px;"/>
            <script>
            var value=function onSubmit()
                      {
                        var marks;  
                        if((document.getElementById('checkbox-1').checked) && (document.getElementById('checkbox-2').checked) && document.getElementById('checkbox-5').checked)
                          return ++marks;
                      }
                      </script>         
        </div>       
    </apex:form>
</apex:page>

The error is ' Unknown property 'OnlineExamController.o'    '

Thanks so much in advance?
 
Hello, I am just new to salesforce and cannot figure out why iam getting this error....and trying a lot and lots of searches....
So, this is my controller code...where i am declared List<> variable...

public class OnlineExamController 

    public static String selectedExam{get;set;}
    
    public List<OnlineExam__c> o{get;set;}
    
    public List<Integer> iter{get;set;}
    
    public OnlineExamController(ApexPages.StandardController stdController)
    {
        
    }
    
    public OnlineExamController(){}
    
    
    public  List<SelectOption> examName
    {
        get
        {
            examName=new List<SelectOption>();
            examName.add(new SelectOption('----None---','----None---'));
            examName.add(new SelectOption('DAV_401_EXAM','DAV_401_EXAM'));
            examName.add(new SelectOption('DAV_402_EXAM','DAV_402_EXAM'));
            examName.add(new SelectOption('DAV_403_EXAM','DAV_403_EXAM'));
            examName.add(new SelectOption('DAV_404_EXAM','DAV_404_EXAM'));
            
            return examName;
        }
        set;
    }
    
    public PageReference call()
    {
        system.debug(selectedExam);
        o=[Select Questions__c, A__c, B__c, C__c, D__c, E__c, Answer__c, Multiple__c, ExamName__c From OnlineExam__c];
        system.debug(o);
        iter=new List<Integer>{0,1};
        return null;
    }
}
Ad this one is my vf page code , just showing the part which is causing the error because the whole code is too big...to display...

<apex:page controller="OnlineExamController">
<apex:form>
   .
   .
   .
<div class="slds-form slds-form_stacked" style="display:block;">
            <div class="slds-form-element" style="width:100%; margin-top:5%;">
                <div style="float:left;">
                    <label class="slds-form-element__label" style="font-size:20px; margin-left:20px; text-align:left;">Question No.1</label> 
                </div>
                
                <div style="position:relative;float:left; width:70%; margin-left:10px">
                    <b style="font-size:20px;">
         (--PART--------<apex:repeat value="{!iter}" var="pos">
                            <apex:outputText  value="{!o.[pos].Questions__c}"/>
                        </apex:repeat>--------CAUSING ERROR---------)
                    </b>
                </div>

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

Thanks in advance.
i have a controller as'OnlineExamController' in which i have declared a variable ' o ' as shown below in controller code..


public class OnlineExamController 

    public Integer value{get;set;}
    public String selectedExam{get;set;}
    // public List<OnlineExam__c> o{get;set;}
    
    public OnlineExamController(ApexPages.StandardController stdController)
    {
        // oc = new OnlineExamController();
        
        
    }
    
    public OnlineExamController(){
        
        // ex=new ExamController(oc);
        
    }
    
    
    public  List<SelectOption> examName
    {
        get
        {
            examName=new List<SelectOption>();
            examName.add(new SelectOption('----None---','----None---'));
            examName.add(new SelectOption('DAV_401_EXAM','DAV_401_EXAM'));
            examName.add(new SelectOption('DAV_402_EXAM','DAV_402_EXAM'));
            examName.add(new SelectOption('DAV_403_EXAM','DAV_403_EXAM'));
            examName.add(new SelectOption('DAV_404_EXAM','DAV_404_EXAM'));
            
            return examName;
        }
        set;
    }
    
    public List<OnlineExam__c> o
    {
        get
        {
            try
            {
                o=new List<OnlineExam__c>();
                
                o=[Select Questions__c, A__c, B__c, C__c, D__c, E__c, Answer__c, Multiple__c, ExamName__c From OnlineExam__c Where ExamName__c=:selectedExam];
            }
            catch(Exception ex)
            {
                o=null;
                system.debug('object is null');
            }
            return o;
        }
        private set;
    }
    
    public void selectPage()
    {
        if(o[0].Multiple__c > 0)
        {
            value=1;   
        }
        else
        {
            value=0;
        }
    }
    
    public PageReference call()
    {
        system.debug(selectedExam);        
        return null;
    }
}

which is giving me an error on my vf page ExamPage2, this is my page code....

<apex:page controller="OnlineExamController">S
    <apex:form >
        <apex:slds />
        <div class="slds-p-top_xx-large">
            <div style="background-color:rgba(255,219,172,0.3);width:100%">
                <h1 style="font-size:40px;" align="center">DAV_403_EXAM</h1>
            </div>
            <div style="background-color:rgb(182,120,152);height:30%;width:80%;border-radius:10px; margin : 0 auto; margin-top:2%;">
                <br/><br/>
            </div>
            <!--<div style="backgroung-color:rgba(182,120,152,0.1);height:40%;width:100%">

</div>-->
            <div style="display:block; width:100%; float:right; text-align:right; margin-top:20px;">
                <b>Remaining Time</b>
            </div>
        </div>
               
        <style>
            
            .button {
            background-color: #4CAF50 !important; /* Green */
            border: none !important;
            color: white !important;
            padding: 12px 30px !important;
            text-align: center !important;
            
            display: inline-block !important;
            font-size: 15px !important;
            margin: 4px 2px !important;
            -webkit-transition-duration: 0.4s !important; /* Safari */
            transition-duration: 0.4s !important;
            cursor: pointer !important;
            -webkit-border-radius:10px !important;
            }
            
            .button1 {
            background-color: white !important; 
            color: black !important; 
            border: 2px solid #7f7fff !important;
            }
            
            .button1:hover {
            background-color: #4CAF50 !important;
            color: blue !important;
            }
        </style>
        
       
        <div class="slds-form slds-form_stacked" style="display:block;">
            <div class="slds-form-element" style="width:100%; margin-top:5%;">
                <div style="float:left;">
                    <label class="slds-form-element__label" style="font-size:20px; margin-left:20px; text-align:left;">Question No.1</label> 
                </div>
                
                <div style="position:relative;float:left; width:70%; margin-left:10px">
----------------- <b style="font-size:20px;">{!o[0].Questions__c}</b> --------------(error part)-----------------------------------
                </div>
                
                <div style="position:relative;float:left; width:70%; margin-left:10px">
                    <b style="font-size:20px;">Note:-</b> <text style="font-size:20px;">Multiple Answers Can be Correct</text>
                </div>
                
                <div style="float:right; width:5%;">
                    <span style="background:blue; text-style:bold; text-decoration:underline; color:white; padding:5px; font-size:15px; border-radius:10px">
                        Marks
                    </span>
                </div>
            </div>
            <div style="float:left; width:100%" id="checkbox_style">                                
                <fieldset class="slds-form-element" >
                    <div class="slds-form-element_control">
                        <span class="slds-checkbox" style="margin-left:250px;margin-top:20px">
                            <input type="checkbox" name="options" id="checkbox-1" value="on" />
                            <label class="slds-checkbox__label" for="checkbox-1">
                                <span class="slds-checkbox_faux"></span>
                                <span class="slds-form-element__label">DVD</span>
                            </label>
                        </span>
                        <span class="slds-checkbox" style="margin-left:250px;margin-top:20px">
                            <input type="checkbox" name="options"  id="checkbox-2" value="on" />
                            <label class="slds-checkbox__label" for="checkbox-2">
                                <span class="slds-checkbox_faux"></span>
                                <span class="slds-form-element__label">Speaker</span>
                            </label>
                        </span>
                        <span class="slds-checkbox" style="margin-left:250px;margin-top:20px">
                            <input type="checkbox" name="options" id="checkbox-3" value="on" />
                            <label class="slds-checkbox__label" for="checkbox-3">
                                <span class="slds-checkbox_faux"></span>
                                <span class="slds-form-element__label">Monitor</span>
                            </label>
                        </span>
                        <span class="slds-checkbox" style="margin-left:250px;margin-top:20px">
                            <input type="checkbox" name="options" id="checkbox-4" value="on" />
                            <label class="slds-checkbox__label" for="checkbox-4">
                                <span class="slds-checkbox_faux"></span>
                                <span class="slds-form-element__label">Mouse</span>
                            </label>
                        </span>
                        <span class="slds-checkbox" style="margin-left:250px;margin-top:20px">
                            <input type="checkbox" name="options" id="checkbox-5" value="on" />
                            <label class="slds-checkbox__label" for="checkbox-5">
                                <span class="slds-checkbox_faux"></span>
                                <span class="slds-form-element__label">Printer</span>
                            </label>
                        </span>
                    </div>
                </fieldset>
            </div>
                        
        </div>
        
        <hr size="0" style = "visibility : hidden"/>
        
        <div class="slds-form-element" style="display:block;margin-top:10px">
            <b style="font-size:20px;margin-top:20px;">Mark as Unread</b>
            <span class="slds-checkbox" style="margin-left:50px;">
                <input type="checkbox" name="options" id="checkbox-6" value="on" />
                <label class="slds-checkbox__label" for="checkbox-6">
                    <span class="slds-checkbox_faux"></span>
                    <!---       <span class="slds-form-element__label">Checkbox Label</span>--->
                </label>
            </span>
        </div> 
        
        <div class="slds-form-element" style="margin-top:30px;margin-left:200px;">
            <apex:commandButton value="< Previous" styleClass="button button1" />
            <apex:commandButton value="Next >" styleclass="button button1" style="margin-left:10px;"/>
            <apex:commandButton value="Review" styleClass="button button1" style="margin-left:10px;"/>
            <apex:commandButton value="Submit"  onclick="onSubmit" styleClass="button button1" style="margin-left:10px;"/>
            <script>
            var value=function onSubmit()
                      {
                        var marks;  
                        if((document.getElementById('checkbox-1').checked) && (document.getElementById('checkbox-2').checked) && document.getElementById('checkbox-5').checked)
                          return ++marks;
                      }
                      </script>         
        </div>       
    </apex:form>
</apex:page>

The error is ' Unknown property 'OnlineExamController.o'    '

Thanks so much in advance?