4 Replies Latest reply on Jan 6, 2012 1:44 PM by gkaiseril

    Java script issue: Trying to have a script work on all pages

    jpentium12

      Hello,

           I am having a problem with my script in livecycle. I am trying to create random generated numbers, but the code i have use only works on one page. I have 128 pages i need it to cover. The code is as follows. Please let me know if you have a solution. Oh and the boxes i have created are named the same throughout all of the pages

      Thanks

       

      topmostSubform.Page1.ButtonCreateCards::click - (JavaScript, client)
      var varN1 = Math.round(1 + (15-1)*Math.random());
      var varN2 = Math.round(1 + (15-1)*Math.random());
      while (varN2 == varN1)
      {
      varN2 = Math.round(1 + (15-1)*Math.random());
      }
      var varN3 = Math.round(1 + (15-1)*Math.random());
      while (varN3 == varN1 || varN3 == varN2)
      {
      varN3 = Math.round(1 + (15-1)*Math.random());
      }
      var varN4 = Math.round(1 + (15-1)*Math.random());
      while (varN4 == varN1 || varN4 == varN2 || varN4 == varN3)
      {
      varN4 = Math.round(1 + (15-1)*Math.random());
      }
      var varN5 = Math.round(1 + (15-1)*Math.random());
      while (varN5 == varN1 || varN5 == varN2 || varN5 == varN3 || varN5 == varN4)
      {
      varN5 = Math.round(1 + (15-1)*Math.random());
      }

      B1.rawValue = varN1;
      B2.rawValue = varN2;
      B3.rawValue = varN3;
      B4.rawValue = varN4;
      B5.rawValue = varN5;


      var varN1 = Math.round(16 + (30-16)*Math.random());
      var varN2 = Math.round(16 + (30-16)*Math.random());
      while (varN2 == varN1)
      {
      varN2 = Math.round(16 + (30-16)*Math.random());
      }
      var varN3 = Math.round(16 + (30-16)*Math.random());
      while (varN3 == varN1 || varN3 == varN2)
      {
      varN3 = Math.round(16 + (30-16)*Math.random());
      }
      var varN4 = Math.round(16 + (30-16)*Math.random());
      while (varN4 == varN1 || varN4 == varN2 || varN4 == varN3)
      {
      varN4 = Math.round(16 + (30-16)*Math.random());
      }
      var varN5 = Math.round(16 + (30-16)*Math.random());
      while (varN5 == varN1 || varN5 == varN2 || varN5 == varN3 || varN5 == varN4)
      {
      varN5 = Math.round(16 + (30-16)*Math.random());
      }

      I1.rawValue = varN1;
      I2.rawValue = varN2;
      I3.rawValue = varN3;
      I4.rawValue = varN4;
      I5.rawValue = varN5;