Add rows with mutiple controls on each button click using javascript or ajax

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • TechnoAtif
    New Member
    • Sep 2007
    • 63

    Add rows with mutiple controls on each button click using javascript or ajax

    [HTML]<form name=frm action="" method="post">
    <table>
    <tr><td><sele ct name=combo>
    <option>1</option>
    <option>2</option>
    <option>3</option>
    <option>4</option>
    </select>
    <td><input type="text" name=tb1 value=""></td>
    <td><input type="text" name=tb2 value=""></td>
    <td><input type="text" name=tb3 value=""></td>

    </tr>
    <input type="submit" name=submit value=AddRow>
    </table>
    </form>[/HTML]
    Hi all .Here is the code for a simple html design .All the controls here are in a single line.
    In addition to that ,there is a submit button
    Well my real problem starts now.
    What iam supposed to do is to write some code such that
    each time on clicking of AddRow button a new row with all those controls is generated.
    For example,on clicking the button first time ,one such row is generated with a List/Menu Box,and three text boxes.
    On next click i have another such row and in all two rows.
    On third click i have three such rows and so on.
    All this is to be done in php So i posted in the php section of the forum.ut there i get to know that it would be better if i use
    javascript or ajax for this.So now i'm posting this problem in this javascript/ajax section.
    I have some idea but that is not worthy enough to be implemented.
    I am making some increment function in javascript to be called on the onclick eventof the addrow button.
    Though its not of much help,so if any one can help me out,You are most welcome.Please go ahead

    Thanks and rergards
    TechnoAtif
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    No need for Ajax, just some simple DHTML.

    This link provides some explanation, code and demo.

    Comment

    • TechnoAtif
      New Member
      • Sep 2007
      • 63

      #3
      Hi acoder
      Thanx for the link.Its indeed very helpful.Next i wanted to know that is there any way out to perform the same task using Dojo Doolkit.I'm sure you must be aware of it.It also uses DHTML. and javascript.

      Thanks and Regards
      TechnoAtif

      Comment

      • vijay
        New Member
        • Aug 2006
        • 31

        #4
        use DHTML.......... ............... ..

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #5
          Originally posted by TechnoAtif
          Hi acoder
          Thanx for the link.Its indeed very helpful.Next i wanted to know that is there any way out to perform the same task using Dojo Doolkit.
          Read the API for dijit.form.

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #6
            Originally posted by vijay
            use DHTML.......... ............... ..
            Did you read the thread and post no. 2?

            Comment

            • TechnoAtif
              New Member
              • Sep 2007
              • 63

              #7
              Hi acoder

              So you mean to say that i can use
              [PHP]dijit.form.Text Box(params: Object?, srcNodeRef: DomNode|String) [/PHP]
              in place of:

              [PHP]var el = document.create Element('input' );
              el.type = 'text';
              el.name = 'txtRow' + iteration;
              el.id = 'txtRow' + iteration;[/PHP]

              Can you please elaborate further

              Thanks and Regards
              TechnoAtif

              Comment

              • acoder
                Recognized Expert MVP
                • Nov 2006
                • 16032

                #8
                No, that's just the API. I don't use dojo, so I can't be much more help.

                If you don't know how to use dojo, I would suggest using the JavaScript code in the link - it's not that difficult.

                Comment

                • TechnoAtif
                  New Member
                  • Sep 2007
                  • 63

                  #9
                  Unfortunately ,i have no option left lest to use Dojo as its what the client is demanding.So if anyone can help me.please come forward.

                  Thanks and Regards
                  TechnoAtif

                  Comment

                  • acoder
                    Recognized Expert MVP
                    • Nov 2006
                    • 16032

                    #10
                    You're either going to learn it yourself (a good idea), ask in a Dojo specific forum or wait for someone to turn up and answer.

                    Comment

                    Working...