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
Fabian Paul 6Fabian Paul 6 

Error in Vf Page Unknown Property 'visualForceArrayList.'

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.
Nayana KNayana K
Inside apex:repeat change the outputText line to <apex:outputText value="{!o[pos].Questions__c}"/>

Because o is a list, you cannot do o.[pos]
Waqar Hussain SFWaqar Hussain SF
<apex:repeat value="{!o}" var="pos">
                            <apex:outputText  value="{!pos.Questions__c}"/>
                        </apex:repeat>

try above code
Fabian Paul 6Fabian Paul 6
Thanks so much nayana the error is gone but still value of the list is not displayed on the vf page...can u tell me why i m wrong?
thanks
Nayana KNayana K
Use the code posted by Waqar Hussain SF. That's the right approach and you don't need iter variable (you don't really need it)... I think you are calling call() method from button. In that case rerender the outputPanel with it's id and keep your apex:repeat code inside this outputPanel..

Also, seems you have to change the query like this 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];
 
Fabian Paul 6Fabian Paul 6
<div class="slds-col" style="margin-right:400px">
                        <span>
                            <div class="slds-form-element__control" style="float:left;">
                                <div class="slds-select_container">
                                    <apex:selectList value="{!selectedExam}" multiselect="false" size="1" styleClass="slds-select slds-input slds-input-large">
                                        <apex:selectOptions value="{!examName}"/>
                <-------------------<apex:actionSupport event="onchange" action="{!call}" reRender="hidden">--------------------------->
                                            <apex:param assignTo="{!str}" value="{!selectedExam}"/>
                                        </apex:actionSupport>
                                    </apex:selectList>
                                </div>
                            </div>
                        </span>
                    </div>

This is the part where my call func..is being called, not using outputpanel....?do i have to maintain id in this part also?
 
Nayana KNayana K
<div class="slds-col" style="margin-right:400px">
	<span>
		<div class="slds-form-element__control" style="float:left;">
			<div class="slds-select_container">
				<apex:selectList value="{!selectedExam}" multiselect="false" size="1" styleClass="slds-select slds-input slds-input-large">
					<apex:selectOptions value="{!examName}"/>
						<apex:actionSupport event="onchange" action="{!call}" reRender="tableOp">
						<apex:param assignTo="{!str}" value="{!selectedExam}"/>
					</apex:actionSupport>
				</apex:selectList>
			</div>
		</div>
	</span>
</div>
...
<apex:outputPanel id="tableOp">
<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;">
	<apex:repeat value="{!o}" var="record">
					<apex:outputText  value="{!record.Questions__c}"/>
				</apex:repeat>
			</b>
		</div>
</apex:outputPanel>

 
Nayana KNayana K
<apex:actionSupport event="onchange" action="{!call}" reRender="tableOp">
						
					</apex:actionSupport>

Hey I think no need of param inside actionsupport. Use like above 
Fabian Paul 6Fabian Paul 6
Thanks Nayana....but that's too not working....
Nayana KNayana K
Can you please post whole code once? VF + class.
Fabian Paul 6Fabian Paul 6
Its been a long.....i got my exams....you asked for the whole code....

<---------------VF Page---------------------->

<apex:page controller="OnlineExamController">
    <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>
        
        <apex:outputPanel id="tableOp">
            
            <div class="slds-form slds-form_stacked" style="display:block;">
                <!---   <apex:outputPanel id="tableOp"> --->
                <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;">
                            <apex:repeat value="{!o}" var="pos">                            
                                <apex:outputText value="{!pos.Questions__c}"/>                            
                            </apex:repeat>                        
                        </b>
                    </div>
                </div>
                <!---    </apex:outputPanel> ----->
                
                <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 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">{!o[0].A__c}</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">{!o[0].B__c}</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">{!o[0].C__c}</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">{!o[0].D__c}</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">{!o[0].E__c}</span>
                                </label>
                            </span>
                        </div>
                    </fieldset>
                </div>           
            </div> 
        </apex:outputPanel>
        
        <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>


<-----------------apex-------------------------->

public class OnlineExamController 

    public static String selectedExam{get;set;}
    
    public List<OnlineExam__c> o{get;set;}
    

    
    public OnlineExamController(ApexPages.StandardController stdController)
    {
        system.debug('hello world');
    }
    
    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 Where ExamName__c=:selectedExam];
        system.debug(o[0].Questions__c);
        return null;
    }
}