You need to sign in to do that
Don't have an account?
Pharaohgirl
Lookup field not appearing in master-detail relationship on Visualforce page
Hello,
I'm trying to create a page that allows users to add new records for a custom object with master-detail relationships.
Project_team__c is the parent and Contact__c and Rule_closeout_report__c are child objects (via master-detail).
The page I've created allows me to add information and save a new record, but the "Contact name" and "Rule closeout report" fields do not appear as lookup - they just allow the user to enter free text.
Provided the text is entered correctly, it works perfectly. But I want these fields to show as lookup fields. Could you please help me make this work?
I'm trying to create a page that allows users to add new records for a custom object with master-detail relationships.
Project_team__c is the parent and Contact__c and Rule_closeout_report__c are child objects (via master-detail).
The page I've created allows me to add information and save a new record, but the "Contact name" and "Rule closeout report" fields do not appear as lookup - they just allow the user to enter free text.
Provided the text is entered correctly, it works perfectly. But I want these fields to show as lookup fields. Could you please help me make this work?
<apex:page standardController="Project_team__c" standardStylesheets="false" applyBodyTag="false" applyHtmlTag="false" showHeader="false" sidebar="false" cache="true" > <apex:form> <html> <body> <style> .buttons{background-color:#7D4082;background-image:none;color:#FFFFFF;font-weight:bold;font-size:120%;} .basictable, td {border-collapse: collapse; padding-right: 15px; font-size:90%; padding-top: 10px; padding-bottom: 10px; font-family:"Helvetica",sans-serif; } </style> <apex:pageBlock title="Add project team members to your close-out report"> <table class=".basictable" > <tr> <td><strong><apex:outputLabel value="Contact name:"></apex:outputLabel></strong></td> <td><apex:inputField label="" style="width: 85%; height: 25px" value="{!Project_team__c.Contact__c}"></apex:inputField></td> <td><strong><apex:outputLabel value="Role:"></apex:outputLabel></strong></td> <td><apex:inputField label="" style="width: 85%; height: 25px" value="{!Project_team__c.Role__c}"></apex:inputField></td> <td><strong><apex:outputLabel value="Notes:"></apex:outputLabel></strong></td> <td><apex:inputField label="" style="width: 85%; height: 25px" value="{!Project_team__c.Notes__c}"></apex:inputField></td> <td><strong><apex:outputLabel value="Project number:"></apex:outputLabel></strong></td> <td><apex:inputField label="" style="width: 85%; height: 25px" value="{!Project_team__c.Rule_closeout_report__c}"></apex:inputField></td> </tr> </table> </apex:pageBlock> <br></br> <div align="left" draggable="false" > <apex:commandButton styleClass="buttons" id="savenewteammember" value="Add new team member" action="{!save}" style="height:35px;width:18%;" /> </div> <br></br> </body> </html> </apex:form> </apex:page>
This is how it currently appears:
Please try the below code:
This worked for me.Hope this will be helpful
Thanks.
All Answers
Hi Raj,
Thanks for your reply.
I tried that, but it didn't make a difference. Still no lookup fields.
Thanks,
Rowena
Remove background-image:none; from the styles
Unfortunately still hasn't solved it :(
That style was just for the button, but I tried removing it anyway. Still the same result - no lookup fields.
Thanks,
Rowena
Please try the below code:
This worked for me.Hope this will be helpful
Thanks.
So using showHeader="false" prevents the lookup function from working. Anyone know why?
Rowena