You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2021/04/27 14:43:18 UTC

[airavata-django-portal] branch airavata-3453 updated: AIRAVATA-3453 Initialize radio button inputs with value

This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch airavata-3453
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git


The following commit(s) were added to refs/heads/airavata-3453 by this push:
     new 49bfe3d  AIRAVATA-3453 Initialize radio button inputs with value
49bfe3d is described below

commit 49bfe3d41818b5d32f689746239a16b86b42d0f2
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Tue Apr 27 10:34:02 2021 -0400

    AIRAVATA-3453 Initialize radio button inputs with value
---
 .../workspace/templates/django_airavata_workspace/supcrtbl2.html  | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/django_airavata/apps/workspace/templates/django_airavata_workspace/supcrtbl2.html b/django_airavata/apps/workspace/templates/django_airavata_workspace/supcrtbl2.html
index 588fc3b..de5d017 100644
--- a/django_airavata/apps/workspace/templates/django_airavata_workspace/supcrtbl2.html
+++ b/django_airavata/apps/workspace/templates/django_airavata_workspace/supcrtbl2.html
@@ -57,12 +57,16 @@ document.getElementById("experiment-editor").addEventListener('loaded', e => {
         const radios = document.querySelectorAll(`[name="input:${input.name}"]`);
         for (const radio of radios) {
           if (radio.value === input.value) {
-            radio.checked = true;
+            // Have to set value with setAttribute so it is part of the DOM
+            // since the slot content doesn't appear to get added to the custom
+            // element until later. Setting as a property doesn't work.
+            radio.setAttribute("checked", "checked");
             break;
           }
         }
+      } else if (inputEl.type === 'text') {
+        inputEl.setAttribute("value", input.value);
       }
-      inputEl.setAttribute("value", input.value);
     }
     // document.getElementById("myinput").setAttribute("value", input.value);
   }