Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-26909

When switching between projects into the creation popup screen, "script" tags or velocity fields templates are omitted

    XMLWordPrintable

Details

    Description

      NOTE: This bug report is for JIRA Server. Using JIRA Cloud? See the corresponding bug report.

      In my plugin I need to attach an handler JS function (defined in my 'edit' vm template) based on the customfield id, written between "script" tags, as in the example below :

      #customControlHeader ($action $customField.id $customField.name $fieldLayoutItem.required $displayParameters $auiparams)
      
      <script type="text/javascript">	
      	myHandlerFunc_${customField.id} = function() {
      		// some code here...
      	});
      
      	AJS.$('${customField.id}').ready(myHandlerFunc_${customField.id});
      </script>
      
      <!--
      	Some HTML/VELOCITY code here...
      -->
      
      #customControlFooter ($action $customField.id $fieldLayoutItem.fieldDescription $displayParameters $auiparams)
      

      This handler function is well attached on the customfield#1 when opening the creation popup directly on the JIRA project on which customfield#1 is contextualized, but never if I switch on an other project on which customfield#2 (same type) is contextualized.

      It seems that, when switching between projects, you are injecting refreshed HTML for fields using the jQuery method .html( htmlString ) which is, according to the comment of Neil M in this jQuery documentation page, stripping all script tags :

      Also, if you are trying to add html that contains SCRIPT elements, these elements will be stripped from the resulting html. Not sure if this is the browser's rendering or if it's jQuery, but either way, I see it as being a protective layer against script injection.

      ==> my customfield type is unusable

      Have you got any workaround or advice for me ? Could you try to do something about that please ?

      Thank you in advance for your time,
      Cheers
      Clément Capiaux
      Valiantys developer

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              d3d89166ee96 ClémentC
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: