2 Replies Latest reply on Sep 21, 2009 1:57 AM by Sean hepburn

    Should this be a function?

    Sean hepburn

      Hi all, I have the code below attached to about 3000 small boxes that insert a text when clicked, it works very well, but I can't help thinking that it's not very efficient!

       

      I've tried fragments, but each box needs to be referenced and I assume that if you change one fragment you change them all.

       

      I also looked at functions and script objects, but I'm lost as it seems to me that you can't use (if - then) etc. within a function.

       

      Would someone be kind enough to tell me if it's possible to convert this to a function and roughly how, please.

       

      Many thanks..Sean

       

      var deleted = substr(Header.currnturl[0].rawValue,64,150)

      if (Header.currnturl[0].rawValue == null and $.rawValue == null) then

      xfa.host.messageBox("Please paste a valid URL link into the first page", "No URL Link?", 0, 0)

      elseif

      ($.rawValue == null) then

      $.rawValue = deleted

      $.access = "readOnly"

      Rectangle10.assist.toolTip = deleted

      else

      var urljoin = concat((Header.urlstart[0].rawValue),

      ($.rawValue))

      xfa.host.gotoURL(urljoin)

      endif