2 Replies Latest reply on Jan 30, 2007 3:03 AM by nick.endgame

    looping links


      My goal is to be able to determine how many links have been entered into a textarea field.

      If there are more than 3 links entered into the textarea then display message.

      How can I do this?
        • 1. Re: looping links
          Dan Bracuk Level 5
          teststring = form.textareastring;
          links = 0;
          KeepGoing = true;
          while(keepgoing) {
          here = findnocase(teststring, "href");
          if (here gt 0) {
          links = links + 1;
          teststring = mid(teststring, here + 4, len(teststring);
          keepgoing = false;
          } // loop

          Then do something with the links variable.
          • 2. Re: looping links
            nick.endgame Level 1
            Hi Dan,

            Thanks for the reply. I tried out the script you posted and it worked.

            However, I did have to swap the positioning of the findnocase parameters:

            here = findnocase(strContent, "href");

            here = findnocase("href", strContent);

            By the way i'm using CF 7.

            Also, I'd just like to say thank you very much for your superb help.