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
Sushant RaoSushant Rao 

Make apex:SelectList an editable input field

Is there a native VF way to wrap a Input text around a selectList. I should be able to select an option and then the value is set to an input text which I could edit. Natively SelectList is not editable.This doesn't work but it would look something like this ...

 

Thanks !!!!!!!!

 

  <apex:inputText value="{!ContractName}" styleClass="inputText"   >                  
             <apex:selectList size="1" readonly="false" >
                            <apex:selectOptions value="{!contractNames}"/>
              </apex:selectList>  
   </apex:inputText>

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

Ah, so you are looking for some kind of combo where the selectlist can be typed over if nothing in the list matches?  I've not come across any way to do that I'm afraid.

 

All Answers

bob_buzzardbob_buzzard

If your selectlist and inputtext are backed by the same controller property, I think you'd be able to do this.  However, you'd need to refresh the page once the user had made a selection to update the input text.

 

Personally, I'd back the inputtext and selectlist with different controller properties and use javascript to update the contents of the inputtext when the user selects an item.

Sushant RaoSushant Rao
It works with two controllers , except I want the selectionlist to show up inside the input box , the way the vf currently displays it as two separate components . The ideal situation would be the selections embedded inside the inputtext. Thanks for the assistance !
bob_buzzardbob_buzzard

Ah, so you are looking for some kind of combo where the selectlist can be typed over if nothing in the list matches?  I've not come across any way to do that I'm afraid.

 

This was selected as the best answer
Sushant RaoSushant Rao
Ok . Thanks for letting me know .