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
PremanathPremanath 

visible the fields on picklist selection

Hi guys,

 

   please help me...

 

I have a pick list field Qualification in Application Object ,

Qualification (picklist)

BE/B-Tech

M_Tech

Degree

INTER

ssc

 

if i select -BE/B-Tech

Related fields should be visible. i.e

enter college:

enter semister marks:

 

If i select -- SSC

Enter school:

enter section

grade:

 

 

So like this fields should be visible on selection.

 

How can i achive with Visual force tabs/Any custom functionality.         please help me....

 

Thank you,

 

Best Answer chosen by Admin (Salesforce Developers) 
Navatar_DbSupNavatar_DbSup

Hi,

Try the below code snippet as reference:

<apex:page >

    <apex:form >

        <apex:selectList id="chooseColor" size="1" onchange="test(this.value)">

            <apex:selectOption itemValue="btech" itemLabel="BE/B-Tech"/>

            <apex:selectOption itemValue="mtech" itemLabel="M.Tech"/>

            <apex:selectOption itemValue="degree" itemLabel="Degree"/>

            <apex:selectOption itemValue="inter" itemLabel="Inter"/>

            <apex:selectOption itemValue="ssc" itemLabel="SSC"/>

        </apex:selectList>

        <div id="btechblock" style="display:none">

        <apex:outputText >Enter College</apex:outputText><br/>

        <apex:outputText >Enter Senester Marks</apex:outputText><br/>

        </div>

          <div id="sscblock" style="display:none">

        <apex:outputText >Enter school</apex:outputText> <br/>

        <apex:outputText >Enter section</apex:outputText><br/>

        <apex:outputText >Grade</apex:outputText><br/>

        </div>

    </apex:form>

    <script>

    function test(st)

    {

        if(st=='btech')

        {

            document.getElementById('sscblock').style.display='none';

            document.getElementById('btechblock').style.display='block';

        }

        else if(st=='ssc')

        {

            document.getElementById('btechblock').style.display='none';

            document.getElementById('sscblock').style.display='block';

        }

    }

    </script>

</apex:page>

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

All Answers

Navatar_DbSupNavatar_DbSup

Hi,

Try the below code snippet as reference:

<apex:page >

    <apex:form >

        <apex:selectList id="chooseColor" size="1" onchange="test(this.value)">

            <apex:selectOption itemValue="btech" itemLabel="BE/B-Tech"/>

            <apex:selectOption itemValue="mtech" itemLabel="M.Tech"/>

            <apex:selectOption itemValue="degree" itemLabel="Degree"/>

            <apex:selectOption itemValue="inter" itemLabel="Inter"/>

            <apex:selectOption itemValue="ssc" itemLabel="SSC"/>

        </apex:selectList>

        <div id="btechblock" style="display:none">

        <apex:outputText >Enter College</apex:outputText><br/>

        <apex:outputText >Enter Senester Marks</apex:outputText><br/>

        </div>

          <div id="sscblock" style="display:none">

        <apex:outputText >Enter school</apex:outputText> <br/>

        <apex:outputText >Enter section</apex:outputText><br/>

        <apex:outputText >Grade</apex:outputText><br/>

        </div>

    </apex:form>

    <script>

    function test(st)

    {

        if(st=='btech')

        {

            document.getElementById('sscblock').style.display='none';

            document.getElementById('btechblock').style.display='block';

        }

        else if(st=='ssc')

        {

            document.getElementById('btechblock').style.display='none';

            document.getElementById('sscblock').style.display='block';

        }

    }

    </script>

</apex:page>

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

This was selected as the best answer
PremanathPremanath

thank you very much

 

This is more useful for me...

 

i can implement this one in my objects...

 

Thanks a lot,,