multiple items with the same id (edit-in-place)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • littlegreen
    New Member
    • Mar 2008
    • 17

    multiple items with the same id (edit-in-place)

    Hi all,
    I'm seeking for solution of my post in php forum of this site (http://www.thescripts. com/forum/thread777667.ht ml). So does any here know how to solve it? Thanks.
  • littlegreen
    New Member
    • Mar 2008
    • 17

    #2
    Hi anyone know how to do this? Thanks a lot.

    Comment

    • ronverdonk
      Recognized Expert Specialist
      • Jul 2006
      • 4259

      #3
      As I recall an answer was given (by me) in post http://www.thescripts.com/forum/post3097097-6.html in the PHP forum.

      Why don't you react to that post and tell us what you did with its suggestion. When you do not react tot posts, people are not inclined to continue their assistance.

      Ronald

      Comment

      • littlegreen
        New Member
        • Mar 2008
        • 17

        #4
        Originally posted by ronverdonk
        As I recall an answer was given (by me) in post http://www.thescripts.com/forum/post3097097-6.html in the PHP forum.

        Why don't you react to that post and tell us what you did with its suggestion. When you do not react tot posts, people are not inclined to continue their assistance.

        Ronald
        Hi ronverdonk, I'm sorry about that. I thought you ask me to post here rather than in PHP forum. Thanks for your help. I did try your suggestion but I modify a bit in the fifth line and also the <b>editinplace. js</b> as shown below. After I tried, I got what I want but that's an error on page icon show in the left bottom of my ie browser. Do you what happen to this error?

        Code:
        Line: 3813
        Char: 5
        Error: Object required
        Code: 0
        [PHP]
        while($disp=mys ql_fetch_array( $disp_de))
        {
        echo '<tr><td>';
        $dis= $disp['pp_photo_desc'];
        echo '<p id="desc'.$a.'" >'.$dis."</p>";
        echo '</td></tr>';
        $a++;
        }
        [/PHP]

        Code:
        function init(){
        var max=50;
        for(i=0; i<max ;i++){
        makeEditable('desc'+i);
        }
        }

        Comment

        • ronverdonk
          Recognized Expert Specialist
          • Jul 2006
          • 4259

          #5
          Code:
          function init(){
          var max=50;
          for(i=0; i<max ;i++){
          makeEditable('desc'+i);
          }
          }
          are you sure you have 50 items to makeEditable? I assume that you have less and therefore you run into this error. If you use the dom to do anything you must verify in your JS rouitine that the object exists.

          Ronald

          Comment

          • littlegreen
            New Member
            • Mar 2008
            • 17

            #6
            Originally posted by ronverdonk
            are you sure you have 50 items to makeEditable? I assume that you have less and therefore you run into this error. If you use the dom to do anything you must verify in your JS rouitine that the object exists.

            Ronald
            haha, not sure. Sometimes less than but sometimes more than that. But due to this, I ever tried to put the for statement like for(i=0; ;i++), but this will make my pc hang. If really can't verify, then do you have any idea to make the error on the page icon disappear? Thank you. ^^

            Comment

            • ronverdonk
              Recognized Expert Specialist
              • Jul 2006
              • 4259

              #7
              My opinion is to test the existence of the id in the function, like
              Code:
              function init(){
                var myId;
                var max=50;
              
                for(i=0; i<max ;i++){
                  myId='desc'+i;
                  if (getElementById(myId))   	
                     makeEditable(myId);
                }
              }
              but I am not a really good JS expert, so give it a try.

              Ronald

              Comment

              • littlegreen
                New Member
                • Mar 2008
                • 17

                #8
                Originally posted by ronverdonk
                My opinion is to test the existence of the id in the function, like
                Code:
                function init(){
                  var myId;
                  var max=50;
                
                  for(i=0; i<max ;i++){
                    myId='desc'+i;
                    if (getElementById(myId))   	
                       makeEditable(myId);
                  }
                }
                but I am not a really good JS expert, so give it a try.

                Ronald
                Thanks. I had tried this, but it can't work on my case. It still have the error on page as shown below.

                Code:
                Line: 9
                Char: 5
                Error: Object expected
                Code: 0

                Comment

                Working...