Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    ValuesManager.getValues() and ValuesManager.saveValues() differences?

    Hi Isomorphic,

    do you have an idea that could explain the difference between a client-side a logged getValues() call and the values actually sent in the request by saveData() immediately afterwards (v12.1p_2022-08-10)? There is no fancy transformRequest on the DataSource or anything like this, just DynamicForm and ValuesManager.
    I got my DynamicForm's name via the Watch Tab in the developer console and then enter this in the "Evaluate JS Expression"-box:
    Code:
    isc_InternEnableDynamicForm_0.valuesManager.getValues();
    Result in log (see ENABLED: false, which is a CheckBox in a DynamicForm with one item, currently not checked):
    Code:
    Evaluator: result of 'isc_InternEnableDynamicForm_0.valuesManager.getValues();...' (0ms):
    {INTERN_PASSWORD_NEED_UPPERCASE: true,
    INTERN_PASSWORD_NEED_NUMBER: true,
    INTERN_CAN_USE_OLD_PASSWORD_AS_NEW_PASSWORD: false,
    INTERN_PASSWORD_MAX_LENGTH: 12,
    ENABLED: false,
    INTERN_PASSWORD_NEED_LOWERCASE: true,
    TYPE: "intern",
    INTERN_PASSWORD_MIN_LENGTH: 6}
    I then click that enabled-box to check it and try again:
    Code:
    isc_InternEnableDynamicForm_0.valuesManager.getValues();
    Result in log (see ENABLED: true, which is a CheckBox in a DynamicForm with one item, currently checked):
    Code:
    Evaluator: result of 'isc_InternEnableDynamicForm_0.valuesManager.getValues();...' (0ms):
    {INTERN_PASSWORD_NEED_UPPERCASE: true,
    INTERN_PASSWORD_NEED_NUMBER: true,
    INTERN_CAN_USE_OLD_PASSWORD_AS_NEW_PASSWORD: false,
    INTERN_PASSWORD_MAX_LENGTH: 12,
    ENABLED: true,
    INTERN_PASSWORD_NEED_LOWERCASE: true,
    TYPE: "intern",
    INTERN_PASSWORD_MIN_LENGTH: 6}
    I now execute saveData(), again in the Evaluate JS Expression-box:
    Code:
    isc_InternEnableDynamicForm_0.valuesManager.saveData();
    Result in log:
    Code:
    Evaluator: result of '//isc_InternEnableDynamicForm_0.valuesManager.getValues();...' (142ms):
    {operationType: "update",
    dataSource: "INTERN_LOGIN_CONFIG",
    data: Obj,
    callback: Obj,
    requestId: "INTERN_LOGIN_CONFIG_request38",
    _origUseStrictJSON: undef,
    useStrictJSON: null,
    _origFallbackToEval: undef,
    fallbackToEval: false,
    textMatchStyle: "exact",
    _alreadyDuped: true,
    oldValues: Obj,
    afterFlowCallback: "isc_ValuesManager_8._saveDataReply(dsReq..."[63],
    operation: Obj{ID:updateInternSettings},
    operationId: "updateInternSettings",
    componentId: "isc_ValuesManager_8",
    prompt: "Speichere Formulardaten …",
    editor: [ValuesManager ID:isc_ValuesManager_8],
    internalClientContext: Obj,
    willHandleError: true,
    lastClientEventThreadCode: "TMR5",
    _origParentNode: undef,
    parentNode: null,
    _origBypassCache: undef,
    bypassCache: true,
    showPrompt: true,
    _dsCallback: Obj,
    unconvertedDSRequest: Obj,
    dataProtocol: "getParams",
    _dsRequest: Obj,
    _callStack: "\r\n [c]RPCManager.sendRequest(request=..."[1917],
    jsonReviver: DataSource.jsonReviver(),
    suppressAutoDraw: true,
    _localActionURL: undef,
    actionURL: "http://lms.localhost/lms/sc/IDACall?loca..."[45],
    transport: "xmlHttpRequest",
    useSimpleHttp: undef,
    promptStyle: "cursor",
    promptCursor: "progress",
    useCursorTracker: false,
    cursorTrackerConstructor: "Img",
    cursorTrackerProperties: Obj,
    _component: [ValuesManager ID:isc_ValuesManager_8],
    showedPrompt: true,
    transactionNum: 26}
    Request data in RPC Tab (see that ENABLED:false is sent to the server, even though the getValues()-call above said it is true)
    Code:
    {
        dataSource:"INTERN_LOGIN_CONFIG",
        operationType:"update",
        operationId:"updateInternSettings",
        componentId:"isc_ValuesManager_8",
        data:{
            INTERN_PASSWORD_NEED_UPPERCASE:true,
            INTERN_PASSWORD_NEED_NUMBER:true,
            INTERN_CAN_USE_OLD_PASSWORD_AS_NEW_PASSWORD:false,
            INTERN_PASSWORD_MAX_LENGTH:12,
            ENABLED:false,
            INTERN_PASSWORD_NEED_LOWERCASE:true,
            TYPE:"intern",
            INTERN_PASSWORD_MIN_LENGTH:6
        },
        textMatchStyle:"exact",
        callback:{
            target:[ValuesManager ID:isc_ValuesManager_8],
            methodName:"saveEditorReply"
        },
        showPrompt:true,
        prompt:"Speichere Formulardaten …",
        oldValues:{
            INTERN_PASSWORD_NEED_UPPERCASE:true,
            INTERN_PASSWORD_NEED_NUMBER:true,
            INTERN_CAN_USE_OLD_PASSWORD_AS_NEW_PASSWORD:false,
            INTERN_SPECIAL_CHARS_REQUIRED:null,
            INTERN_PASSWORD_MAX_LENGTH:12,
            ENABLED:false,
            INTERN_PASSWORD_NEED_LOWERCASE:true,
            TYPE:"intern",
            INTERN_PASSWORD_MIN_LENGTH:6
        },
        requestId:"INTERN_LOGIN_CONFIG_request38",
        internalClientContext:{
        },
        fallbackToEval:false,
        afterFlowCallback:"isc_ValuesManager_8._saveDataReply(dsRequest, dsResponse, data)",
        editor:[ValuesManager ID:isc_ValuesManager_8],
        lastClientEventThreadCode:"TMR5",
        bypassCache:true,
        dataProtocol:"getParams"
    }

    Do you have an idea?

    Thank you & Best regards
    Blama

    #2
    DataSource.transformRequest(), as you say, would be the obvious one. We're not sure if you have yet started to use Dynamic Properties but that could be another source of a value change.

    We would start by simply searching through your application code for "ENABLED" and looking closely at your configuration of that particular checkbox as well as any and all event handlers on the form.

    There's no indication yet of a framework flaw here, but if you suspect one, you could try using a different field name for the checkbox.

    Comment


      #3
      Hi Isomorphic,

      I tried with different fieldnames. In the end, it is a stupid mistake on our part. The field was defined twice, in both forms.
      Is there a valid reason for fields to be present in multiple DynamicForms of a ValuesManager? If not, it would be great if you could issue a warning here in the console.

      See this sample (v12.1p_2022-11-23) an do the following steps:
      • Click "Values" button (inStock: false in output)
      • Click 1st "In Stock" CheckBoxItem
      • Click "Values" button (inStock: true in output)
      • Click "Save" (inStock: false in request)
      While this usage is of course wrong, a warning would have helped here a lot.

      Thank you for the fast answer and the debugging ideas & Best regards
      Blama

      Code:
      isc.ListGrid.create({
          ID: "dsListGrid",
          width: "100%",
          height: "50%",
          autoFetchData: true,
          dataSource: "supplyItem"
      });
      
      isc.ValuesManager.create({
          ID: "vm",
          autoFetchData: false,
          dataSource: "supplyItem"
      });
      
      isc.DynamicForm.create({
          ID: "form0",
          valuesManager: "vm",
          fields: [{
              name: "inStock",
              type: "checkbox",
          }, ]
      });
      isc.DynamicForm.create({
          ID: "form1",
          valuesManager: "vm",
          groupTitle: "Details",
          fields: [{
              name: "inStock",
              type: "checkbox",
          }, {
                  name: "itemName",
                  type: "text",
              },
              {
                  name: "SKU",
              },
              {
                  name: "unitCost",
              }, {
                  name: "nextShipment",
                  useTextField: true
              }
          ]
      });
      
      isc.Button.create({
          ID: "btnValues",
          title: "Values",
          click: "isc.say(vm.getValues())"
      });
      isc.Button.create({
          ID: "btnSave",
          title: "Save",
          click: "vm.saveData()"
      });
      
      isc.VLayout.create({
          width: "100%",
          height: "100%",
          membersMargin: 5,
          members: [dsListGrid, form0, form1, btnValues, btnSave]
      });
      
      vm.fetchData({
          itemID: 2
      });

      Comment


        #4
        Hi Isomorphic,

        what do you think about the suggested warning?

        Best regards
        Blama

        Comment

        Working...
        X