Se0ng11
Se0ng11

Reputation: 2333

Can't submit the data with Jquery for xpages combobox and xpages listbox

wanna ask some question, is Jquery not working with xPages dropdownlist and listbox? When clicking submit button, the value just can't be save into nsf, and stuck at the same screen, I cant debug as xPages did not provide any debugging tools for me to debug code behind, so frustrated with xPages

I did solve the previous problem with the listbox, by replace the listbox with a hidden editbox, with some array, and the submit button work like a charm. I can replace as value are not show to users to see, but

Now I try on drop down, I'm using the same method, remain the drop down, and add another edit box on it, but it seem like dropdown keep disturb the submit button, I don't wish to remove the drop down, but I had no idea with the value that need to submit, any guide? had search through all the code, the drop down did not do anything but just simply show the data, instead of normal way to insert drop down value, I had use Jquery to add the value into drop down based on the selection another drop down, it work like charm, but just can't save into nsf

Part of Jquery code

function insertDropDown(sDiv){
var sKeep=[]; //store data as array
var sValue="";

$('select[id$=hidCombo] option').each(function() {
    sKeep.push($(this).attr('value'));
});

if (sDiv == "") { $('select[id$=comboCompany] option').remove(); return; }
$('select[id$=comboCompany] option').remove();
$('select[id$=comboCompany]').append(new Option("","")); //empty value for the 1at item

for(var i=0;i<=sKeep.length-1;i++){
    if (sKeep[i].trim() != ""){
        if(sKeep[i].substr(0,sDiv.length) == sDiv)
        { 
            var selName=sKeep[i].substr(sDiv.length);
            $('select[id$=comboCompany]').append(new Option(selName,selName));
        }               
    }
}}


function setHidComp(){$('select[id$="comboCompany"]').on('change', function() {
    var sDiv = $('select[id$=comboDivision]').val().trim();

    $('select[id$="hidCombo"]').val(sDiv + $(this).val());
    $('input[id$="inputText1"]').val($(this).val());
});

}

xPages sample code

<xp:label value="*Company :" id="fl_Company" for="inputText1" themeId="Form.Label">
                </xp:label></xp:td>
            <xp:td>

            <xp:comboBox id="comboCompany"></xp:comboBox>
            <xp:inputText id="inputText1"><xp:this.value><![CDATA[${javascript:var bt = compositeData.dbSource.flCompany;bt = bt || "currentDocument.fl_Company"; return '#{'+bt+'}';}]]></xp:this.value></xp:inputText></xp:td>

any Idea? As long as combobox have value, I not able to submit successfully, I had search through the web, the info of xPages are so terrible few, and sorry for my poor english

Upvotes: 0

Views: 478

Answers (1)

stwissel
stwissel

Reputation: 20384

The XPages combobox and listbox use dijit controls from the dojo toolkit. Trying to mix jQuery and Dojo isn't for the faint how heart. Unless you have 3 very good reasons (and "I just like it better" is just one), you better stick to Dojo, unless you are OK with burdening the user to load more JavaScript or burden yourself to remove all Dojo from XPages.

Upvotes: 0

Related Questions