PDA

View Full Version : Combox Edit restriction



sajijava
6 May 2009, 11:21 AM
Hi,
I have a EXj combox box which is transformed from and existing html combo box as such.

var convertedFundId =
new Ext.form.ComboBox({
typeAhead: true,
triggerAction: 'all',
transform:'currency',
width:330,
maxHeight:500,
forceSelection:true,
listClass : 'x-combo-selected',
hiddenName:'currency',
cls:'temp',
ctCls:'temp',
selectOnFocus:true,
editable:true,
enableKeyEvents :true
});


<select name="currency" id="currency" class="bodytext">
<option value="USA" selected="selected">United States of America</option>
<option value="GPB" >Great Britain</option>
<option value="CHF" >Switzerland</option>
<option value="JPY" >Japan</option>
<option value="AUD" >Australia</option>
<select>

As you can see we have the typeAhead is set to true. So the user can type the selection.

How can I restict the user to type only the text that was available in the drop down. if they type anything else it should not be shown, i.e. if the user enters 'Uny' the 'y' should not be accepted since it is not available in the drop down.

Any help is greatly appreciated.

-Saji

jay@moduscreate.com
7 May 2009, 3:25 AM
forceSelection does that for you - sort of. That means that the user must select a record for the field to be true.

sajijava
8 May 2009, 11:50 AM
Thanks jgarcia,
If you see the code snippet I posted. I have set the forceSelection=true. It does not work with it either.