Uploaded image for project: 'Moodle app'
  1. Moodle app
  2. MOBILE-3118

"useOtherData" argument does not work with dynamic names in the "core-site-plugins-new-content" directive

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 3.7.1
    • 3.7.0
    • Mobile features
    • Hide

      This issue only needs to be tested in 1 device.

      1. Install the plugin attached to this issue in a 3.5+ site.
      2. In the app, login in that site.
      3. Open a course. Check that you see an option called "My awesome plugin" in the top tabs.
      4. Select that tab. Check that you see a "section" named "Data received" that it's empty. Right after it there's a "section" named "Form" with 2 text fields containing the texts "A value" and "Another value".
      5. Modify the texts and click the Send button. Check that a new page is opened and in the "Data received" section you see 2 fields with the values you entered in the form.
      Show
      This issue only needs to be tested in 1 device. Install the plugin attached to this issue in a 3.5+ site. In the app, login in that site. Open a course. Check that you see an option called "My awesome plugin" in the top tabs. Select that tab. Check that you see a "section" named "Data received" that it's empty. Right after it there's a "section" named "Form" with 2 text fields containing the texts "A value" and "Another value". Modify the texts and click the Send button. Check that a new page is opened and in the "Data received" section you see 2 fields with the values you entered in the form.
    • MOODLE_37_STABLE
    • MOODLE_37_STABLE
    • Moodle App 3.7.1

      The "core-site-plugins-new-content" documentation describes a "useOtherData" argument that does not work with dynamic field names. The documentation for "Accepting dynamic names in a WebService" describes using something like:

      [(ngModel)]="CONTENT_OTHERDATA.data['<% name %>']"
      

      for the names of form elements. When this is used, nothing is added to the "args" parameter when something like [useOtherData]="null" is specified to "core-site-plugins-new-content".

      if something like

      [(ngModel)]="CONTENT_OTHERDATA.<% name %>"
      

      is used, then specific items are added to the "args" parameter. But, this structure will not work for passing the values back into the form. The form needs the [(ngModel)]="CONTENT_OTHERDATA.data['<% name %>']" structure.

      For example, if this is used:

          <ion-textarea aria-multiline="true" [(ngModel)]="CONTENT_OTHERDATA.<%fieldkey%>"
                        core-auto-rows></ion-textarea>
      

      then specifying "useOtherData" will load an 'fieldkey' value into the "args" object.

      But,

          <ion-textarea aria-multiline="true" [(ngModel)]="CONTENT_OTHERDATA.responses['<%fieldkey%>']"
                        core-auto-rows></ion-textarea>
      

      will not.

      Also, when "otherdata" is passed into the template with text for the text field, the first example will not display any value for the textarea, while the second one will.

      To add more confusion, if the argument 'form="myform"' is added, using the first example, no values from the form are returned either with userOtherData or without.

            dpalou Dani Palou
            mchurch Mike Churchward
            Pau Ferrer Pau Ferrer
            Juan Leyva Juan Leyva
            Mike Churchward Mike Churchward
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.