Field onchange event is not firing when item is selected from suggestions - Forum - Rollbase - Progress Community

Field onchange event is not firing when item is selected from suggestions

 Forum

Field onchange event is not firing when item is selected from suggestions

This question has suggested answer(s)

I am facing the problem where the script function in selector field onchange event is not firing when item is selected from suggestions.

Can anyone please suggest a way to do this?

All Replies
  • Request you to share additional details.

    Assuming you are configuring onChange event on field definition page of Relationsip field and the same is not firing on new/edit form pages. Relationship field style is Selector/Picklist?

    Can you please confirm if you are on Public Cloud, if not, which Private Cloud installation version.

    Regards,
    Siraj.
  • Hello Siraj,

    I am on private cloud on Rollbase 4.4 and the field style is a selector.

    This is my case. I have Stock owner and its dependents Consignee and picklist items on the piclkist page. What I want to do is after adding the dependent data, if stockowner is changed, I want to confirm with user and if he wants to proceed, clear all dependent data. If not. reelect the old stockowner.

    this is the code I am using

    and I am calling this ValidatePLSTOChange() function in Onchange event of StockOwner field.

    This is working correctly when stockowner is selected by opening the stockowner lookup. but not working when stock owner is selected from the autofill suggestions.

    -------------------------------------------------------------------------------------------------------------------------------------------------------------

    var selectedStockOwnerPL;
    var StockOwndIdPL;
    var pageObjectPL = rbf_getPageContext();
    var pgTypePL = pageObjectPL.getPageType();

    function ValidatePLSTOChange() {
    selectedStockOwnerPL = $("#R1437061").val();

    if (pgTypePL == 3) { //only in newPage
    if (StockOwndIdPL != null && selectedStockOwnerPL != null && StockOwndIdPL[0] != selectedStockOwnerPL[0]) {
    var rowCount = $("#rbi_gridTable_0 tr[id*=rbi_gridRow]").length;

    if (rowCount > 0) {
    var isConfirm = confirm("Are you sure that you want to change the Stock Owner? The entered data will be reset.");
    if (isConfirm) {
    //reset the entered values.

    //delete all lines entered.
    for (i = 0; i <= rbf_getMaxRowIndex2(0); i++) {
    rbf_delGridRow(0, i);
    }

    //reset the Consignee
    rbf_selectObject(null, "", null, "R1437068", false);

    //renew global variable
    StockOwndIdPL = selectedStockOwnerPL;
    } else {
    //get back the old stockOwner
    rbf_getFields("stock_owner_", StockOwndIdPL, "stock_owner_", setPLStockOwnerLookupVal);
    }
    }
    } else {
    //assign to global variable
    StockOwndIdPL = selectedStockOwnerPL;
    }
    }

    }

    function setPLStockOwnerLookupVal(c, d, fetchedStkOwn) {
    rbf_selectObject(StockOwndIdPL, fetchedStkOwn["stock_owner_"], null, "R1437061", false);
    }