Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by David on Jan 30, 2008 08:24
open dhtmlx forum
dhtmlxCombo: With AJAX - New Options - Forced Submit

Hi all,

first of all - i am german - so it might be a little difficult to explain my wish/problem or how you call it.

I am using a combobox (dhtmlx of course) with filtering mode ON an the nice auto-complete ON. So far.
I am using AJAX to populate my combobox with options using a PHP/MySQL backend. So good.

Now, if the auto-complete does not find any more options (because there are none), i'd like to have the possibility to store that new data to my database. but not simply after typing (onKeyDown / onKeyPressed / ...), but by submitting via button-click.
Best would be that: Swapping the button (combo_select.gif) to an alternative button (i.E. combo_save.gif) if there is no option found.

Is there any workaround, or other ideas to realize that ?


Best regards.
David

PS: Wenn hier jemand meine Sprache versteht, wäre das natürlich sehr gut. Wenn er darüber hinaus auch noch den englischen Text verstanden, sich aber über all die Fehler amüsiert hat, ist das peinlich für mich aber auch egal - haupsache mir wird geholfen :D
Answer posted by Support on Jan 30, 2008 09:45
>>Is there any workaround, or other ideas to realize that ?

Of course, there is no such built-in functionality , but I think it can be added with some code customization

 dhtmlXCombo.prototype._fillFromXML  << this function called when data loaded from server
   ...
    var options=xml.doXPath("//option"); << got all options from xml
    if (options.length){      <<those lines may be added to add custom reaction on empty xml
       //hide custom button
      
    } else {
       //show custom button
      
    }

You can access existing combo_select.gif as
    combo.DOMelem_button

    combo.DOMelem_button.src=....