Accessing combo from function

Hi all!
I’m trying to write a validateAdd function that I would like to use like this:

myForm = new dhtmlXForm("myForm", formData); myForm.attachEvent("onButtonClick", function(name) { if (name == "send") { if (validateAdd() == true) { myForm.send("php/save_data.php","post",function(xml){ alert("Saved!"); myForm.reset(); }); } } });
The validateAdd function looks like this:

function validateAdd(){ if(document.('ComboX').value == ''){ alert("ComboX empty!"); return false; } return true; }
Obviously (document.(‘ComboX’).value == ‘’) is not the right syntax… Could you please show me the right syntax to access the combo from here?

And one last question: is there a way to pass to “php/save_data.php” (which saves my data in a database) the TextValue of the combo instead of its index?

Thanks in advance for your suggestions!!
Marco
Ps. I’m sorry if maybe this is not posted in the correct section of your forum… I was very undecided where to post this… :confused:

Hi
I tried the approach below and it works

myForm.attachEvent("onButtonClick", function(name) { if (name == "send") { if(myForm.getItemValue('ComboX') == null || myForm.getItemValue('ComboX') == ''){ alert("ComboX empty!"); return false; } else { myForm.send("php/save_data.php","post",function(xml){ alert("Saved!"); myForm.reset(); }); return true; } } });

Thanks a lot Darya!
That was just what I needed!!
Marco

Normally combo sends its value not index. So if you have value equals to label, it will send the necessary text.

Hi Stanislav!
Thanks for the explanation!
I had understood from the tutorial/samples that the Id field was supposed to be the auto_increment field that they say you MUST have…
I gather now that it’s only needed internaly to guarantee the uniqueness of the records.

Greetings,
Marco