cancel
Showing results for 
Search instead for 
Did you mean: 
DevMT
Nintex Newbie

Trouble Setting Default Value for Cascading Drop Down List Through JavaScript / JQuery

Hi there,
I have a form which consist of various controls, two of which are List LookUp (Cascading Drop Down List). One of the functionalities of the form is, everytime the "Clear" button is pressed all of the controls are resetted to their default values (most are set as blank) with the exception Cascading Drop Down List. For some reason when I click the clear button it will set the primary cascading drop down list to the default value, but I need to press the clear button again for it to set the secondary cascading drop downlist.

Form Data [Clear button wasn't pressed]
For_Issue_1.png

Form Data [Clear Button was pressed once]
For_Issue_2.png

Form Data [Clear Button was pressed for the second time]
For_Issue_3.png

JavaScript / JQuery code is as follows:

function clearInformation(isCompleteErasure) {
    isDefaultFlag = false;

    if (isCompleteErasure) {
        NWF$("#" + ModelName).parent().find("select").prop("selectedIndex", 0).change();
        NWF$("#" + SerialNumber).val("");
        NWF$(".FormStatusValue").html("");
    }

    originalRecord.RecordID = 0;
    NWF$(".RecordID").html("");
    NWF$("#" + ItemOriginStatus).find("input:radio[value='Brand New']").prop("checked", true).change();
    NWF$("#" + MITAFrameworkAgreement).prop("checked", true).change();
    NWF$("#" + Product).val("");
    NWF$("#" + TimeStamp).val(formatDate(new Date()));
    NWF$("#" + IPAddress).val("");

    NWF$("#" + CurrentLocationDepartment).parent().find("select").find("option:contains('Information Management Unit')").prop("selected", true).change();
    NWF$("#" + CurrentLocationNetworkLocation).parent().find("select").find("option:contains('Stores')").prop("selected", true).change();
    
    NWF$("#" + PreviousLocationDepartment).parent().find("select").prop("selectedIndex", 0).change();
    NWF$("#" + PreviousLocationNetworkLocation).parent().find("select").prop("selectedIndex", 0).change();
    
    NWF$("#" + PreviousLocationDepartment).parent().find("select").prop("disabled", false);
    NWF$("#" + PreviousLocationNetworkLocation).parent().find("select").prop("disabled", false);
    
    NWF$("#" + Remarks).val("");
    NWF$(".ItemHistoryTitle").html("");
    NWF$(".ItemHistoryResult").html("");
    NWF$(".ItemAvailabilityTitle").html("");
    NWF$(".ItemAvailabilityResult").html("");
    newItemFlag = true;
}

The way I see it, it seems that the filtering of the cascading drop down list is being populated post "PostBack" and that is why I have to press the clear button twice in order for it to actually work. If that is the case, I'm a not really sure how I can actually solve this. 


Any help / pointers would be extremely appreciated!

Labels: (1)
0 Kudos
Reply