467,894 Members | 1,748 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,894 developers. It's quick & easy.

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

[HTML]<form name=frm action="" method="post">
<table>
<tr><td><select 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
Apr 10 '08 #1
  • viewed: 1626
Share:
9 Replies
acoder
Expert Mod 8TB
No need for Ajax, just some simple DHTML.

This link provides some explanation, code and demo.
Apr 10 '08 #2
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
Apr 10 '08 #3
use DHTML...........................
Apr 10 '08 #4
acoder
Expert Mod 8TB
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.
Apr 10 '08 #5
acoder
Expert Mod 8TB
use DHTML...........................
Did you read the thread and post no. 2?
Apr 10 '08 #6
Hi acoder

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

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

Can you please elaborate further

Thanks and Regards
TechnoAtif
Apr 10 '08 #7
acoder
Expert Mod 8TB
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.
Apr 10 '08 #8
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
Apr 11 '08 #9
acoder
Expert Mod 8TB
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.
Apr 11 '08 #10

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Jim Heavey | last post: by
3 posts views Thread by Steve Drake | last post: by
22 posts views Thread by Mr Newbie | last post: by
2 posts views Thread by =?Utf-8?B?VG9u?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.