allowFreeText Combo

Hi

I’m very confused . The combo component has allowFreeText(state) method . Dcoumentation say

But I can always write in the combo field, eg in dhtmlx.com/docs/products/dhtmlx … _form.html
In my code if I use
var cateIntcombo=form_i.getCombo("form_combo_4"); cateIntcombo.allowFreeText(false);
this does not work.
I do not understand if I’m wrong or if there is a malfunction.
It seems to me that the previous behavior (old version) was different.

dhtmlxSuite_v502_pro

If the user types something in the combo box the function allowfreeText set the use on that value true or false.

For example,

Is the user types Blablabla in the box but that is not an option then you can deside if “blablabla” chould be considerred as an exepted value.
I think that can be used to for example let the user add some more options to a combo list.

Hope this helped a bit

Hi ,
check the sample
dhtmlx.com/docs/products/dhtmlx … _form.html
Why combo “From script” accepts any text entered ?

{type: "combo", label: "From script", name: "audio", options:[ {text: "AAC", value: "AAC"}, {text: "AC3", value: "AC3", selected: true}, {text: "MP3", value: "MP3"}, {text: "FLAC", value: "FLAC"} ]},
default is false !
jumping focus out from combo nothing is happening.

this is a html page that will show you the difference.
place it in the folder \samples\dhtmlxCombo\01_init
The Page is modified from the existing combo init sample

You can always type in the combo box the difference is what is send to the server.
Type some random text in the combo box and then click somewhere outside the combo box.
A popup will show what you have typed.

Change the myCombo.allowFreeText(true); to myCombo.allowFreeText(false);
Type some random text in the combo box and then click somewhere outside the combo box.
A popup will show what is selected by default.

So if the text is typed inside the box is NOT one of the options it will disregard what the user has typed.
I do notice one “problem” and that is when the user clears the text. it will return an empty string.
Maby that is a bug or not. I dont know.

Hope this explains a bit beter
test.zip (606 Bytes)

Hi totems ,
thank you for all your help.
In your example, you set the mode to false.

[code]myCombo = new dhtmlXCombo(“combo_zone”, “combo”, 230);
myCombo.load(“dhtmlx/samples/dhtmlxCombo/common/data2.json”);
// myCombo.allowFreeText(false);

		myCombo.attachEvent("onBlur", function(){
		alert(myCombo.getActualValue());[/code]

If I comment this line, I see that the default mode is true and not false as written on the documentation.
This behavior forces you to set up any combo in the form .

np glad to help.

I do notice that there are alot of problems with the documentation.
I recently had some problems with validations on a combobox. Turns out I had to take the example from grid to get the validation working on a combo.

I’m working in the IT sector also and I know it’s important to keep the documentation up to date but I also realize that is a massive work.
Sometimes you have to decide if documentation is more important then fixing bugs.

So here comes the forum :laughing: