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
amitashtekaramitashtekar 

Does anyone know how to apply style to dependent picklist.

Hi,

 

I have two picklist fields.

 

I am able to apply style for controlling field but the style is not getting applied to dependent picklist.

 

Does anyone know how to apply style to dependent picklist.

 

Even I put javascript for onchange event of controlling picklist field to apply style for dependent picklist.

But it is not working.

 

It will be great help if some one have any idea to do it.

 

Thanks!

Best Answer chosen by Admin (Salesforce Developers) 
amitashtekaramitashtekar

I have solved this problem.

 

add below style and remove styleclass attribute from inputfield

 

select

{

custom style attributes

}

All Answers

ForceMantis (Amit Jain)ForceMantis (Amit Jain)

Can you post sample code and screenshot as this is UI question?

amitashtekaramitashtekar

I have pasted a sample dummy code for the same.

 

Please let me know if you have any query.

 

Thanks!

 

<apex:page controller="DependentPicklist" >
  <style>
      .picklist
      {
          color:#f00;
          height:18px;
          font-size:12px;
      }
  </style>
  <apex:form >
      <apex:pageBlock >
        <apex:pageBlockSection > 
            <apex:inputField value="{!pageCase.Subject}"/>
            <apex:inputField value="{!pageCase.Description}"/>
            <apex:inputField styleClass="picklist" value="{!pageCase.Category__c}"/>
            <apex:inputField styleClass="picklist" value="{!pageCase.Sub_Category__c}"/>
        </apex:pageBlockSection>
      </apex:pageBlock>
  </apex:form>
</apex:page>

 

public class DependentPicklist
{ 
    public Case pageCase{get;set;}{pageCase = new Case();}
}

 

amitashtekaramitashtekar

I have solved this problem.

 

add below style and remove styleclass attribute from inputfield

 

select

{

custom style attributes

}

This was selected as the best answer
PremanathPremanath
It's Not working At all 
hsupriyahsupriya
Even I would like to know, if you have solved this problem.
PremanathPremanath
Hi Supriya,

  when i am doing my prvious project i faced this issue,
  I have managed with Right click on VF page --> Inspect Element
  there i have changed some thing ...
  May be you can try like this and you will get some idea.


Prem
hsupriyahsupriya
I got it done. You just have to style the Select Option.
amitashtekaramitashtekar
select
{
          color:#f00;
          height:18px;
          font-size:12px;
}

use above style and add more attributes if required.