1

I'm experiencing an issue when trying to modify the style of an apex:inputField which is dependent from another one in a VF Page

What I want to do is set the exact position of the inputField, its width and height, color etc..

Here's the code of the VF Page:

<apex:page>
    <head>
        <style> 
            .picklist {
                height:33px;
                width:255px;
                font-size:14px;
                font-style:italic;
                font-weight:bold;
                text-align:left;
                padding-top:7px;
                padding-bottom:7px;
                padding-left:10px;
                border: 0;
            }
        </style>
    </head>
    <body>
        <apex:form >
            <!-- Parent picklist -->
            <apex:inputField id="parent" value="{!Object__c.parent__c}" styleClass="picklist" style="left:400px; top:250px;"/>
            <!-- Children picklist -->
            <apex:inputField id="children" value="{!Object__c.children__c}" styleClass="picklist" style="left:400px; top:275px;"/>
        </apex:form>
    </body>
</apex:page>

Problem is that the dependent picklist "children" style does not apply to it, width/height/colors are not set and the picklist is set at the bottom of the page automatically. Still the style applies for the parent picklist.

How can I handle that ?

2 Answers 2

1

Install firefox and install firebug as an extension. Rightclick the field which does not take the style as you want and click on inspect with firebug. In the bottom you see which class the element really has and how it is nested in the DOM. On the right side you see the style tab, where you see all styles which matches and you also see which one are overridden by stronger selectors. Possibly you need a more specific selector in your style.

0

Figured out how to do it, still I think that it's not the best way to do it but it works and since the inputFields are rendered as select picklists in html and they all need the same style I added the following code in the style:

select {
    height:33px;
    width:255px;
    font-size:14px;
    font-style:italic;
    font-weight:bold;
    color:#26523C;
    background-color:#9FA074; 
    text-align:left;
    padding-top:7px;
    padding-bottom:7px;
    padding-left:10px;
    border: 0;
}

And added a div with the position where it should be rendered:

<!-- Children picklist -->
<div style="left:400px; top:275px;">
    <apex:inputField id="children" value="{!Object__c.children__c}"/>
</div>

This way the dependent and controller picklists are rendered with same style as I wish it to be.

@Uwe Heim: Thanks anyway, firebug's awesome and helped me out on this.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .