You need to sign in to do that
Don't have an account?

inputtext field as lookup field using visualforce page for custom object fields
Hi,
i have an custom object Position__c ,in this i have a field called
PositionName,
i want to show this textfield in Visualforce page as text box with
lookup field attached.
Please provide some code
Regards,
ANI
try this
<apex:page><apex:form> <apex:inputText /> <a href="#" id="link" title="Contact Lookup (New Window)" tabindex="6" onclick="javascript:window.open('https://ap1.salesforce.com/_ui/common/data/LookupPage?lkfm=editPage&lknm=newOwn&lktp=StandardUserLoo..."><img class="lookupIcon" title="Contact Lookup (New Window)" alt="Contact Lookup (New Window)" src="/s.gif"/></a></apex:form> </apex:page>
Hi Anil,
May I know why you are not using the Standard Controller and inputField to display the lookup field?
Regards,
Shravan
Hi
i did the same,but here position1_c object contains 2 record types ,is it true that record type play role in lookup field ???
and plz look at this code
here position is the field i need to display lookup field
<apex:page standardController="Position1__c" extensions="Jobapp">
<apex:form >
<apex:pageBlock title="New Job Application">
<apex:pageBlockButtons >
<apex:commandButton action="{!Save}" value="Save"/>
<apex:commandButton action="{!Savenew}" value="Save&New"/>
<apex:commandButton action="{!Cancel}" value="Cancel"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Information">
<apex:pageBlockSectionItem >
<apex:outputLabel >Candidate:</apex:outputLabel>
<apex:inputText value="{!cand}"/></apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Position:</apex:outputLabel>
<apex:inputField value="{!Position1__c.name}"/></apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Cover Letter:</apex:outputLabel>
<apex:inputTextarea cols="10" rows="2"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
Status:<apex:selectList value="{!stat}" multiselect="false" size="1">
<apex:selectOptions value="{!status}" ></apex:selectOptions>
</apex:selectList>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Hi Anil,
I donno wat you are trying to do, You are using Standard controller as "Position1__c" and you want to select a position from there.
Do you have a self lookup field on that object? If not first create it.
then you can use that Field API name in the Input field.
<apex:InputField value="{!Position1__c.SelfLookUpfieldAPIName}"/> you get the lookup functionality by default.
Regarding record Type dependency I hope it may, if you have related lookup filters with the record type criteria.
Regards,
Shravan
Hi shravan,
yes i have a lookup field called JobPosition__c as u said i tried
<apex:inputField Value="{!Position__c.JobPosition__c}" />
But it shows error.
do i need to write apex code for this in controller ,if yes plz give me some code for that
Thanks
yeh shravan i got it
thanks it works fine
THanku very much