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
mbforcembforce 

Need Controller code for search button on VFpage

Hi,

 

I am new to visualforce and Apex, need help in creating controller for search button for following

 

I have created two object Student with fields (Name, Date of birth, Email, Phone, Course enrolled) and object Cource with fields (Course Name, Fees, Intake, Start Date)

 

I have created a VF page where I will give course name and search for student details who have enrolled for the cource

 

created the simple VF page with following code, need controller code for searching and displaying students details enrolled for that course.

 

<apex:page sidebar="false" showHeader="false" Controller="studentctrl">
    <apex:form >
        <apex:pageBlock title="Student Search">
            <apex:pageBlockSection title="List of Students Enrolled"></apex:pageBlockSection>
            <apex:pageBlockButtons >
            <apex:outputLabel Value="Course Name: ">  </apex:outputLabel>
              <apex:inputText id="txtcoursename"/>
                <apex:commandButton value="Search"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection >

            </apex:pageBlockSection>
        </apex:pageBlock>
   
    </apex:form>
</apex:page> 

 

Also suggest modification required in VF page code for assigning action to search button..

 

Thanks,

Manish. 

mbforcembforce

Hi All,

 

Please provide controller code for search button for following VF page

 

<apex:page sidebar="false" showHeader="false" Controller="institutectrl">
      <apex:form >
                <apex:pageBlock title="My Content" mode="edit">
            <apex:pageBlockButtons >
                <apex:commandButton value="Search"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection title="List of Students enrolled for a Course" columns="5">
               <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Course Name"/>
                    <apex:inputText id="account__name"/>
                </apex:pageBlockSectionItem>

            </apex:pageBlockSection>
        </apex:pageBlock>   
    </apex:form>
 
 </apex:page>

 

Thanks,

Manish B