1 Reply Latest reply on Dec 6, 2015 1:42 AM by DBarranca

    How organize the collection and display of information in html5 panel Photoshop CC

    AndreyLarush Level 1

      Hi all.

      I Make panel for Photoshop CC 2015. It will contain several elements - inputs, selects, checkboxes, tabs. I want to fill in the required fields when opening the panel. For the convenience information want to keep in a XML file - the name of the user, the list of project folders, etc.

      I think that you need to have an additional file (XML ?) with a description what item (id elements) is what value to set (<li 2 selected>) or show ('Andy') .

      Can't quite come up with the mechanism for implementing this. I would be grateful for tips, examples, ideas.

        • 1. Re: How organize the collection and display of information in html5 panel Photoshop CC
          DBarranca Level 4

          Hi,

          there's no need for a second xml, since you can do the binding in javascript. For instance, if you have an xml like:

           

          <prop>
             <user>John</user>
             <firstInput>Whatever</firstInput>
          <prop>
          

           

          You can read it and then assign to, say, an input text the value in the JS:

           

          document.getElementById("firstInput").value = firstInputValue;
          

           

          To parse an XML file you should be able to:

           

          var dataString = cep.fs.readFile(filePath) // sync process
          var dataObj = (new window.DOMParser()).parseFromString(dataString, "text/xml");
          

           

          Then you should be able to:

           

          firstInputValue = dataObj.firstInput;
          

           

          I haven't tested this myself but it should do the job, let me know.

           

          Davide Barranca

          www.davidebarranca.com

          www.cs-extensions.com