2 Replies Latest reply on Jun 11, 2013 2:30 AM by sheriman

    Where does the ID like “pbG62d78562_2d4676_2d4b22_2d96b8_2d227d65ceaa9f_j_id1” come from?

    sheriman

      I'm working with JavaScript and Facelets page and apply to gatein portal using portlet,

      here my code:

       

      <h:head>
         
      <script type="text/javascript">
             
      function transfer() {
                  alert
      (editor.getMolfile());
                  document
      .getElementById("strMol").value = editor.getMolfile();

                 
      var newVal=document.getElementById("strMol").value;
                  alert
      ("new val"+newVal);
             
      }
         
      </script>
      </h:head>
      <h:body>
         
      <h:form id="searchMoleculeForm">
             
      <h:inputHidden name="strMol" id="strMol" value="#{search.strMol}" />
             
      <rich:panel >
                 
      <f:facet name="header">
                      Search The Molecule
                 
      </f:facet>
                 
      <center>
                     
      <div id="editor"></div>
                 
      </center>
                 
      <center>
                     
      <h:commandButton value="substructure" action="#{search.subStructure}" onclick="transfer();" />
                     
      <h:commandButton value="exact_similar" action="#{search.exactSearch}" onclick="transfer();" />
                     
      <h:commandButton value="pharmacophore" action="#{search.pharmacore}" onclick="transfer();" />
                     
      <h:commandButton value="shape" action="#{search.shapeSearch}" onclick="transfer();" />
                 
      </center>
             
      </rich:panel>
         
      </h:form>
         
      <script type='text/JavaScript'>
             
      var editor = chemwriter.loadEditor('editor');
         
      </script>
      </h:body>

      it not working, and when I view source code, other id coming with the id "strMol" something like this:


      <input id="pbG62d78562_2d4676_2d4b22_2d96b8_2d227d65ceaa9f_j_id1:searchMoleculeForm:strMol" type="hidden"

      so I put that ID inside


      document.getElementById("pbG62d78562_2d4676_2d4b22_2d96b8_2d227d65ceaa9f_j_id1:searchMoleculeForm:strMol") 


      and it started to work..

      my question is, where the other ID come from? how to solve this problem? because i tested to other machine this ID is not same.