Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by barb on Sep 16, 2009 00:38
open dhtmlx forum
dhtmlxcombo with jquery

I have many dhtmlxCombos in my form and want to use ajax to save the contents of the form to a db when it is submitted.

I have experience with using jquery as below. But the value of the combos is not accessible. Is there a way to get the values using this method, or is there a better way to do this using dhtmlxAjax?

$("#addrecipe").submit(function()
    {
     //remove all the class add the messagebox classes and start fading
     $("#msgbox").removeClass().addClass('messagebox').text('Saving....').fadeIn(1000);
     $("#msgbox1").removeClass().addClass('messagebox').text('Saving....').fadeIn(1000);
    
     $.post("save.php",{
         id:$('#id').val(),
         save:$('#submit').val(),
         name:$('#name').val(),
         image:$('#image').val(),
         newimage:$('#newimage').val(),
         measure:$('#measure').val(),
         cat0:$('#cat0').val(),
         cat1:$('#cat1').val(),
         cat2:$('#cat2').val(),
         cat3:$('#cat3').val()
     } ,function(data) {...
Answer posted by Alex (support) on Sep 16, 2009 03:15

The combo value can be got by getActualValue() method:

var value = combo.getActualValue();

Moreover combo creates hidden input with selected value. So, the value is submitted if combo container is placed inside form:

http://dhtmlx.com/docs/products/dhtmlxCombo/samples/02_actions/03_combo_save.html