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
ani123ani123 

ew lookup value to br copied in an textbox field

i have productlookup field in custom vf page,instead of selecting lookup field on type of the content in lookup ield need to save in a text box called new product ????????????

can anyone help me with this

yashagarwalyashagarwal

you would still be using teh lookup to get the value I guess.

 

If so, you can just copy value from the lookup to your text field in teh apex code before saving.  If you want the same on population , you can have a onchange action support with that ionput field , invoking a method that does so.

 

VF page :

 

<apex:inputField value="{!lookup}" >

        <apex:actionSupport event="onchange" action="{!populateText}" rerender ="textBox" />

</apex:inputField>

 

<apex:inputText value="{!textvalue}" id="textBox" />

 

 

Controller

 

public pageReference populateText()

{

      if(lookup != NULL)

              textvalue = lookup;

 

       return null;

}

 

 

Hope thsi helps.

ani123ani123

No i use this logic i am getting error as INvalid Id"

yashagarwalyashagarwal

I am not sure why you gettign the error , it might be becuase you are trying to populate a text filed to the id field. If that is so , please get the actual id for the name and then populate.

 

if nto so , 

try this :

 

if(lookup != NULL)

{

    textValue= '';

    textValue += lookup;

}

 

it would be easier for me to help if you could elaborate on exactly what you are trying to do.