Bobby Brown
asked on
Adobe Flex - Combobox - Disable Editing
Hey,
I have a combo box and I am trying to disable from user typing.. Users can type to select an item but I do not want the combo box item to be modified.. this is what happening now.. :-)
<s:ComboBox id="combocity" width="17%" height="85%"
change="combocity_changeHa ndler(even t)"
dataProvider="{cityListFor combo}" labelField="cityName"
prompt="Select the one"
/>
I have a combo box and I am trying to disable from user typing.. Users can type to select an item but I do not want the combo box item to be modified.. this is what happening now.. :-)
<s:ComboBox id="combocity" width="17%" height="85%"
change="combocity_changeHa
dataProvider="{cityListFor
prompt="Select the one"
/>
ASKER
Thanks zzynx.
But editable is not part of the
<s:ComboBox id="newName" editable="false" width="13%" change="newName_changeHand ler(event) " dataProvider="{employeeLis t}" labelField="empName" prompt="Select the one" textAlign="center" height="85%"/>
It is part of the MX dropdownlist...
But editable is not part of the
<s:ComboBox id="newName" editable="false" width="13%" change="newName_changeHand
It is part of the MX dropdownlist...
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
No Points
Here is a simple answer as recommended by zzynx
https://forums.adobe.com/thread/613475?tstart=0
Here is a simple answer as recommended by zzynx
https://forums.adobe.com/thread/613475?tstart=0
ASKER
Thanks Pravin and Zzynx. I read this article. You see, entire application is created using combobox and now, I need to disable editing - Comboboxes are every where. Do I have to change all the controls to DropDownList? No other way.. ?
Regards,
Regards,
>> Do I have to change all the controls to DropDownList?
The ones that need to be uneditable
>> No other way.. ?
Sorry.
The ones that need to be uneditable
>> No other way.. ?
Sorry.
If you insist, you can do this with some custom class .
Here is excerpts from Adobe forums:
The ComboBox control is a child class of the DropDownListBase control. Like the DropDownListBase control, when the user selects an item from the drop-down list in the ComboBox control, the data item appears in the prompt area of the control.
One difference between the controls is that the prompt area of the ComboBox control is implemented by using the TextInput control, instead of the Label control for the DropDownList control. Therefore, a user can edit the prompt area of the control to enter a value that is not one of the predefined options.
For example, the DropDownList control only lets the user select from a list of predefined items in the control. The ComboBox control lets the user either select a predefined item, or enter a new item into the prompt area. Your application can recognize that a new item has been entered and, optionally, add it to the list of items in the control.
The ComboBox control also searches the item list as the user enters characters into the prompt area. As the user enters characters, the drop-down area of the control opens. It then and scrolls to and highlights the closest match in the item list.
So if you debug your control, you will find a textInput control which permits you to enter/edit the text. You have to make that as non-ediable
Here is excerpts from Adobe forums:
The ComboBox control is a child class of the DropDownListBase control. Like the DropDownListBase control, when the user selects an item from the drop-down list in the ComboBox control, the data item appears in the prompt area of the control.
One difference between the controls is that the prompt area of the ComboBox control is implemented by using the TextInput control, instead of the Label control for the DropDownList control. Therefore, a user can edit the prompt area of the control to enter a value that is not one of the predefined options.
For example, the DropDownList control only lets the user select from a list of predefined items in the control. The ComboBox control lets the user either select a predefined item, or enter a new item into the prompt area. Your application can recognize that a new item has been entered and, optionally, add it to the list of items in the control.
The ComboBox control also searches the item list as the user enters characters into the prompt area. As the user enters characters, the drop-down area of the control opens. It then and scrolls to and highlights the closest match in the item list.
So if you debug your control, you will find a textInput control which permits you to enter/edit the text. You have to make that as non-ediable
ASKER
Thank you very much both.
I started to convert one of the form and I am having one problem.
Selecting the item for the dropdownlist... It is NOT setting the DropDownList... Do you know why?
var selectedRow:Object = event.currentTarget.select edItem; // This is gridview...
delsName.selectedItem=sele ctedRow.em pName;
Here is the declaration:
<s:DropDownList id="delsName" width="18%" height="85%"
change="modifyName_changeH andler(eve nt)"
dataProvider="{empListForc ombo}" labelField="empName"
prompt="Select the one"/>
empListForcombo is:
[Bindable] private var empListForcombo:ArrayColle ction;
private function getEmpComboList():void
{
var dao:EmployeeDAO=new EmployeeDAO;
empListForcombo=dao.getIte ms();
}
public function getItems():ArrayCollection
{
return getList("SELECT EMPLOYEE.*, CITY.Name as CITY " +
"FROM EMPLOYEE LEFT JOIN CITY ON CITY.CITY_ID = EMPLOYEE.CITY_ID");
}
I started to convert one of the form and I am having one problem.
Selecting the item for the dropdownlist... It is NOT setting the DropDownList... Do you know why?
var selectedRow:Object = event.currentTarget.select
delsName.selectedItem=sele
Here is the declaration:
<s:DropDownList id="delsName" width="18%" height="85%"
change="modifyName_changeH
dataProvider="{empListForc
prompt="Select the one"/>
empListForcombo is:
[Bindable] private var empListForcombo:ArrayColle
private function getEmpComboList():void
{
var dao:EmployeeDAO=new EmployeeDAO;
empListForcombo=dao.getIte
}
public function getItems():ArrayCollection
{
return getList("SELECT EMPLOYEE.*, CITY.Name as CITY " +
"FROM EMPLOYEE LEFT JOIN CITY ON CITY.CITY_ID = EMPLOYEE.CITY_ID");
}
>> Selecting the item for the dropdownlist... It is NOT setting the DropDownList...
What do you mean? Can you elaborate on that?
What do you mean? Can you elaborate on that?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Pravin Asar, did the trick. Thank you so much.
Cheers.
Cheers.
ASKER
Pravin Asar,
I accepted this as a solution, then I realized your comment about user can not type... so, I am actually using the dropdownlist... Your solution is still a great one.
The problem is that you see, I have a datagrid and when I double click on it, I am display a form with it's data. I can not seem to select the data on the dropdownlist.
This is what I use to select an entry.
ModclientCombo.selectedIte m = selectedRow.clientName;
It's is not selecting the client name
I accepted this as a solution, then I realized your comment about user can not type... so, I am actually using the dropdownlist... Your solution is still a great one.
The problem is that you see, I have a datagrid and when I double click on it, I am display a form with it's data. I can not seem to select the data on the dropdownlist.
This is what I use to select an entry.
ModclientCombo.selectedIte
It's is not selecting the client name
ASKER
Pravin Azar, I figured it out. Thanks again.
Glad to know, you figured the last hurdle.
Thanx 4 axxepting
Open in new window