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
Avinash BarolaAvinash Barola 

Salesforce site is not working

hello I create a site with only one page. when i run my site home page(siteHomePage) from preview its working well but when i run it from site url its not working properly.it initially shows a select list with correct options but when i select any option from list it not diving the detail of selected option.

Here is my vf page:-
<apex:page sidebar="false" showHeader="false" standardController="Student__c" extensions="SiteHomeController">
    <apex:pageBlock >
        <apex:form >
            <apex:pageBlockSection >
                <apex:selectList value="{!selectedValue}" size="1" label="Select Student Name" onchange="clickme()">
                    <apex:selectOptions value="{!selectList}"></apex:selectOptions>
                    <apex:actionFunction name="clickme" action="{!getStudent}" reRender="show" />
                </apex:selectList>
            </apex:pageBlockSection>
        </apex:form>
        <apex:pageBlock >
        <apex:pageBlockSection >Hii
            <apex:outputPanel id="show" >
            <apex:pageBlockTable value="{!student}" var="s" >
                <apex:column value="{!s.Id}" headerValue="Id" />
                <apex:column value="{!s.Name}" headerValue="Name" />
                <apex:column value="{!s.Age__c}" headerValue="Age" />
                <apex:column value="{!s.DOB__c}" headerValue="DOB" />
                <apex:column value="{!s.Class__c}" headerValue="Class" />
            </apex:pageBlockTable>
            </apex:outputPanel>
        </apex:pageBlockSection>
    
    </apex:pageBlock>
    </apex:pageBlock>
    
</apex:page>



and here is my controller:-

public class SiteHomeController {
    public List<Student__c> stdList{set ;get ;} 
    public List<Student__c> student{set ;get ;}
    public String selectedValue{set ;get ;}
    public ApexPages.StandardController controller;
    public SiteHomeController(ApexPages.StandardController con) {
        controller = con;
        student = new List<Student__c>();
    }
    
    public List<SelectOption> getselectList() {
        System.debug('hii');
        List<SelectOption> selectList = new List<SelectOption>();
        stdList = [select Name from Student__c];
        for(Student__c std : stdList) {
            selectList.add(new SelectOption(std.Id,std.Name));
        }
        return selectList;
    }
    
    public PageReference getStudent() {
        try{
            student = [select Id,Name,Age__c,Class__c,DOB__c from Student__c where id =:selectedValue limit 1] ;
            return null ;
        }
        catch(Exception e){
            System.debug('Catch');
            System.debug(e);
            return new PageReference('/apex/errorfinder');
        }
       
    }
}
Bhaswanthnaga vivek vutukuriBhaswanthnaga vivek vutukuri
Once check field level access in the Public Access Settings