how to fix the width of a dependent picklist insie a apex:repeat tag It is not accepeting any of the css styles eg: Width:150px width:!important need help on this
public List<Contact> contacts{get;set;} public test(){ contacts = [SELECT ID, Name FROM Contact LIMIT 1000]; } }
Screenshot:
Make changes in the style according to you. I have changed the color of the Contacts, you can set the width as well. Hope it Helps you. Mark this answer Solved if it resolves your query.
I have implemented the code in my Org it is working fine. Below is the code. Please try that code.
VisualForce Code :
<apex:page controller="test">
<body>
<apex:form>
<apex:repeat value="{!contacts}" var="Page1">
<apex:inputField value="{!Page1.LeadSource}" style="width:400px"/><br/>
<apex:inputField value="{!Page1.CleanStatus}"/>
</apex:repeat>
</apex:form>
</body>
</apex:page>
Apex Controller :
public class test{
public List<Contact> contacts{get;set;}
public test(){
contacts = [SELECT LeadSource, CleanStatus FROM Contact LIMIT 1000];
}
}
Screenshot:
1. First PickList is of standard size and another Picklist is with width:400px
Set the width of PickList according to your requirement. Hope it Helps you. Mark this answer Solved if it resolves your query.
Regards ,
Suraj
All Answers
Below is code for your requirement. It is working fine in my Org. I have used a Standard Object 'Contact'
VisualForce Code :
<apex:page controller="test">
<style>
.redColor{
color : red;
}
.blueColor{
color : blue;
}
</style>
<apex:variable var="index" value="{!1}"/>
<apex:repeat value="{!contacts}" var="contact">
<span class="{!IF(MOD(index,2)==0,'redColor','blueColor')}">{!contact.Name}</span><br/>
<apex:variable var="index" value="{!index+1}"/>
</apex:repeat>
</apex:page>
Apex Controller :
public class test{
public List<Contact> contacts{get;set;}
public test(){
contacts = [SELECT ID, Name FROM Contact LIMIT 1000];
}
}
Screenshot:
Make changes in the style according to you. I have changed the color of the Contacts, you can set the width as well. Hope it Helps you. Mark this answer Solved if it resolves your query.
Regards ,
Suraj
<apex:repeat value="{!coWrapperList}" var="Page1">
<apex:outputLabel >Objective1222</apex:outputLabel> <apex:inputField value="{!page1.compl.Compliance_Objective1__c}" style="width:150px" > <span class = "width:150px"></span> </apex:inputField> </apex:pageBlockSectionItem>
</apex:repeat>
Suraj the objective is a dependent picklist and I cannot fix the size of it it would be helfpul if u clarify Thanks in advance
I have implemented the code in my Org it is working fine. Below is the code. Please try that code.
VisualForce Code :
<apex:page controller="test">
<body>
<apex:form>
<apex:repeat value="{!contacts}" var="Page1">
<apex:inputField value="{!Page1.LeadSource}" style="width:400px"/><br/>
<apex:inputField value="{!Page1.CleanStatus}"/>
</apex:repeat>
</apex:form>
</body>
</apex:page>
Apex Controller :
public class test{
public List<Contact> contacts{get;set;}
public test(){
contacts = [SELECT LeadSource, CleanStatus FROM Contact LIMIT 1000];
}
}
Screenshot:
1. First PickList is of standard size and another Picklist is with width:400px
Set the width of PickList according to your requirement. Hope it Helps you. Mark this answer Solved if it resolves your query.
Regards ,
Suraj
if I use style attribute inside inputField it is not accepting the change Please do help on this suraj