• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

readOnly vs disabled fields

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • readOnly vs disabled fields

    I have NAB app which allows user to specify where a printed report should be routed.
    They can send to email, send to an outq, or send to both.
    The form has checkboxes for EmailSelected and OutqSelected.

    This app also needs to be able to make email or outq required or forbidden, and in either of those cases the user should not be able to modify the value.
    Using DisableField('EmailSelected') works ok for the display, but when the field is disabled the button helper program is not able to retrieve the value.

    It seems like it's making the field disabled and what I might want to do instead is make the field readOnly. Is there any setReadOnly(true | false) functionality in NAB?

  • #2
    We will take a look at this and report back Monday/Tuesday

    Need to do some digging to see why we would not pass down fields that are disabled on a form

    Thanks

    Comment


    • #3
      We are unable to replicate this one. We see that we are passing the form fields down even if they are disabled. I even transformed the field to a checkbox and disabled it.

      If your button is not directly on the form is your RPG program doing a SetWidget before performing the get form value for example GetFormChar?

      Thanks

      Comment


      • #4
        Finally getting back to this...

        The front end wasn't sending those fields at all when they were disabled, but it was something wrong with the form (not sure what it was but I recreated the form and it seems to be working now).

        Same form, different problem. This time we're on version 6.0.20220119.0
        When my Y/N checkbox is disabled, the value being sent to the backend is true instead of "Y".

        Example app:

        Data Source:
        Code:
        SELECT
           cast('' AS char(1)) AS sel1,
           cast('' AS char(1)) AS sel2,
           cast('' AS char(1)) AS sel3
        FROM
           sysibm.sysdummy1
        Form:
        All three fields are selected, editable, and transformed to "Y" / "N" checkboxes
        form.png
        form_checkbox.png
        The form has a form-helper program

        Form Helper (TESTFORM):
        Code:
        dcl-proc Process;
        dcl-pi *n end-pi;
        
        dcl-s sel1 char(1);
        dcl-s sel2 char(1);
        dcl-s fld char(10);
        
        if gMode = 'formRender';
            SetValue('SEL1' : 'Y');
            DisableField('SEL1');
            SetAppVar('disabledField' : 'SEL1');
        
        else;
            sel1 = vvin_char('SEL1');
            sel2 = vvin_char('SEL2');
        
            if gField = 'SEL3';
                fld = GetAppVar('disabledField');
                if fld = 'SEL1';
                    EnableField('SEL1');
                    SetValue('SEL2' : 'Y');
                    DisableField('SEL2');
                    SetAppVar('disabledField' : 'SEL2');
                else;
                    EnableField('SEL2');
                    SetValue('SEL1' : 'N');
                    DisableField('SEL1');
                    SetAppVar('disabledField' : 'SEL1');
                endif;
            endif;
        endif;
        
        end-proc Process; 
        When the field is enabled it sends "Y" / "N" and when it's disabled it sends true/false
        Code:
        pgm: TESTFORM
        action: change
        field: SEL3
        widgetId: 1611
        nabTmpl: true
        SEL2: N
        SEL3: Y
        SEL1: true
        Code:
        pgm: TESTFORM
        action: change
        field: SEL3
        widgetId: 1611
        nabTmpl: true
        previousValue: true
        SEL1: Y
        SEL3: N
        SEL2: true
        Code:
        pgm: TESTFORM
        action: change
        field: SEL3
        widgetId: 1611
        nabTmpl: true
        SEL2: Y
        SEL3: Y
        SEL1: false

        Comment


        • #5
          We will attempt to replicate this and get back to you...thanks for the detailed info.

          Comment


          • #6
            We have replicated and fixed this issue. The fix will be included in the upcoming 6.1 release.

            Comment


            • #7

              Having same issue with disabled fields.


              Version: 6.1.20220518.0

              Data source:
              SELECT cast('' AS char(10)) AS field1
              FROM sysibm.sysdummy1

              Form:
              Just a regular 'ol form with FIELD1 set as editable, and Auto Load turned off.
              Form helper program:
              HTML Code:
              if gMode = 'formRender';
                 SetValue('FIELD1' : 'TEST2');
                 DisableField('FIELD1');
              endif;

              App:
              Only has this one form.
              Added a button to the form that will call an RPG program.


              The form renders correctly (has "TEST2" value and is disabled).
              Button does call the RPG program, but does not send anything for FIELD1.


              Request:
              HTML Code:
              pgm: TEST3
              action: behavior
              primary: widget-form-1018
              nabTmpl: true
              widget-form-1018_rows1: [{}]
              widget-form-1018: {"totalCount":0,"selectionCount":1,"dataSourceId":1753,"widgetId":1927}
              vvUser: PBEHR

              It's a little easier to see when there are two fields, so I gave that a shot...
              HTML Code:
              pgm: TEST3
              action: behavior
              primary: widget-form-1018
              nabTmpl: true
              widget-form-1018_rows1: [{"FIELD2":"Field2 Val"}]
              widget-form-1018: {"totalCount":0,"selectionCount":1,"dataSourceId":1753,"widgetId":1927}
              vvUser: PBEHR

              Comment


              • #8
                Thanks for all the information!

                We were able to replicate this and it will be fixed in the next 6.1 update

                Comment

                Working...
                X