473,503 Members | 1,831 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dynamic Table problem

22 New Member
Hi,
Im working on HTML table. There is two list items. Lets say both items are kind of process. So every time I press the button both list will be selected n they will be listed in a table(in a new row). User can select as many as they want. Now, there will be another button which will bring each selected process in a column, that means row will go to column with the selected value. I have done it but dunno know how to get those listed value in columns. Plz help me !!
Jan 28 '07 #1
7 1643
pronerd
392 Recognized Expert Contributor
??? Sorry I can not follow any of that

If all you need to to is move text from one place to another it would be something like :

<div id="div1" >Some text string</div>
<div id="div2" ></div>

<script>
var textToMove = document.getElementById("div1").innerHTML'';
document.getElementById("div2").innerHTML = textToMove;
</script>
Jan 28 '07 #2
acoder
16,027 Recognized Expert Moderator MVP
Hi,
Im working on HTML table. There is two list items. Lets say both items are kind of process. So every time I press the button both list will be selected n they will be listed in a table(in a new row). User can select as many as they want. Now, there will be another button which will bring each selected process in a column, that means row will go to column with the selected value. I have done it but dunno know how to get those listed value in columns. Plz help me !!
Not sure if I've understood your problem. Perhaps if you post your code, it might help.
Jan 29 '07 #3
junal
22 New Member
Not sure if I've understood your problem. Perhaps if you post your code, it might help.
actually i have solved the problem. here is the code...hope u can understand what i meant....but i got another problem with it. it doesnt work in IE but in firefox :(.....can u help me ?....thx for the reply.

[HTML]<HTML><HEAD>
<TITLE>test</TITLE>
<script LANGUAGE="JavaScript">

var col1=new Array();
var col2=new Array();
var x=0;

__uid = 0;
__uid1 = 0;

doc = document;

function addRowTo(id) {
x++;
var newrow;
var tbl;
var newcol , newinput;
if(x==1)
{
tbl = doc.getElementById(id);
newrow = doc.createElement("TR");
newcol = doc.createElement("TD");
newinput = doc.createElement("input");
newinput.value = "Process";
newcol.appendChild(newinput);
newrow.appendChild(newcol);
newcol = doc.createElement("TD");
newinput = doc.createElement("input");
newinput.value = "title";
newcol.appendChild(newinput);
newrow.appendChild(newcol);


tbl.appendChild(newrow);
__uid++;
}
tbl = doc.getElementById(id);
//create a new row
newrow = doc.createElement("TR");

newcol = doc.createElement("TD");
newcol.width = 200;
newinput = doc.createElement("input");
newinput.name = "date"+__uid;
newinput.size = 20;
newinput.value = doc.main.date.value;
col1[x]=newinput.value;
newcol.appendChild(newinput);
newrow.appendChild(newcol);


newcol = doc.createElement("TD");
newcol.width = 200;
newinput = doc.createElement("input");
newinput.name = "end"+__uid;
newinput.size = 20;
newinput.value = doc.main.end.value;
col2[x]=newinput.value;
newcol.appendChild(newinput);
newrow.appendChild(newcol);


tbl.appendChild(newrow);
__uid++;


document.main.date.value = '';

document.main.end.value = '';

document.main.date.focus();
//alert(x);

}


function generateTable(id){

var hmrc=0;
var h=0;
var newrow;
var tbl;
var newcol , newinput;

var loopcounter=0;

tbl = doc.getElementById(id);
//create a new row
newrow = doc.createElement("TR");
newcol = doc.createElement("TD");
newcol.width = 200;
newinput = doc.createElement("input");
newinput.name = "head";
newcol.appendChild(newinput);
newrow.appendChild(newcol);


while ( loopcounter<x ){

newcol = doc.createElement("TD");
newcol.width = 200;
newinput = doc.createElement("input");
newinput.name = "newrow1table"+__uid1;
newinput.size = 20;
newinput.value = col1[loopcounter+1];
newcol.appendChild(newinput);
newrow.appendChild(newcol);
loopcounter++;

}
tbl.appendChild(newrow);
__uid1++;

loopcounter=0;
newrow = doc.createElement("TR");
newcol = doc.createElement("TD");
newcol.width = 200;
newinput = doc.createElement("input");
newinput.name = "head";
newcol.appendChild(newinput);
newrow.appendChild(newcol);

while ( loopcounter<x ){

newcol = doc.createElement("TD");
newcol.width = 200;
newinput = doc.createElement("input");
newinput.name = "newrow2table"+__uid1;
newinput.size = 20;
newinput.value = col2[loopcounter+1];
newcol.appendChild(newinput);
newrow.appendChild(newcol);
loopcounter++;

}
tbl.appendChild(newrow);
__uid1++;

h=parseInt (doc.newtable.hmr.value);
//alert(h);

hmrc++;

while (hmrc<=h){

loopcounter=0;

newrow = doc.createElement("TR");
newcol = doc.createElement("TD");
newcol.width = 200;
newinput = doc.createElement("input");
newinput.name = "head"+hmrc;
newinput.value= "Test "+hmrc;
newcol.appendChild(newinput);
newrow.appendChild(newcol);

while ( loopcounter<x ){

newcol = doc.createElement("TD");
newcol.width = 200;
newinput = doc.createElement("input");
newinput.name = "env"+loopcounter;
newinput.size = 20;
newinput.value = "";
newcol.appendChild(newinput);
newrow.appendChild(newcol);
loopcounter++;

}

tbl.appendChild(newrow);
hmrc++;
}


}
</script>
</HEAD>
<body>
<form name="main" method='post'>
<table id="tbl1">
<tbody id="tbl1body">

<tr>
<td><label>
<select name="date">
<option>Seelct</option>
<option>Se</option>
<option>Wa</option>
</select>
</label>

</td><td><label>
<select name="end">
<option>Seelct</option>
<option>WM</option>
<option>WS</option>
</select>

</label>

<a href="#" onClick="addRowTo('tbl1body')">
<img border=0 src="/images/add.gif"></a>
</td>
</tr>

</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp; </p>
<table id="myTable">
</form>
<form name="newtable" method="post" action="">
<label>
<p>
<input name="hmr" type="text" value="3">
</p>
<p> <input type="button" name="Button" value="TEst" onClick="generateTable('myTable')">
</p>
</label>


</table>


</form>
<p>&nbsp;</p>
</html>[/HTML]
Jan 29 '07 #4
acoder
16,027 Recognized Expert Moderator MVP
Your table start tag with id myTable is in the wrong place. Put it after the second form together with the table closing tag:
[HTML]<table id="myTable">
</table>[/HTML]
Jan 29 '07 #5
junal
22 New Member
Your table start tag with id myTable is in the wrong place. Put it after the second form together with the table closing tag:
[HTML]<table id="myTable">
</table>[/HTML]
still not working :(.....
Jan 30 '07 #6
acoder
16,027 Recognized Expert Moderator MVP
In IE, you need a tbody tag within the table tags, as you have done with the first table. Then pass the id of the tbody instead of 'myTable' into the generateTable() function. It worked for me on IE6.
Jan 31 '07 #7
junal
22 New Member
In IE, you need a tbody tag within the table tags, as you have done with the first table. Then pass the id of the tbody instead of 'myTable' into the generateTable() function. It worked for me on IE6.
Thank You so much!...its working :)...now i got another question! what i have to do if i want to add "move up" and "move down" button in first form with dynamic rows?
Jan 31 '07 #8

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

Similar topics

2
29749
by: Martin Feuersteiner | last post by:
Hi I'm grateful for any light you can shed on this!! I've to admit, it's an unusual design but I've multiple contact tables named e.g. i2b_ash_contact or i2b_ted_contact. 'i2b_' and...
14
14769
by: Ina Schmitz | last post by:
Hello, I would like to get the logical and physical reads for every sql statement executed. Thatfore, I used the command "db2 get snapshot for dynamic sql on <mydatabase>". There, I could see...
3
1798
by: Tyler Carver | last post by:
I am trying to use some dynamic controls that are built and then added to tables. The problem that I am having is the timing of when I can populate the controls and have the state remain after a...
1
4816
by: russ | last post by:
Hi all, Here's a problem I'm having with a dynamic table. Following the guidelines here (http://www.codeproject.com/aspnet/dynamiccontrols.asp), which make perfect sense. The problem is that...
7
1881
by: Abraham Luna | last post by:
how do i stop the dynamic validators from breaking explorer if i use a dynamic validator and move to a different control it breaks explorer and i can type in the page when i'm not supposed to....
7
3371
by: serge | last post by:
How can I run a single SP by asking multiple sales question either by using the logical operator AND for all the questions; or using the logical operator OR for all the questions. So it's always...
9
4264
by: Mike Hofer | last post by:
BACKGROUND: We've designed a Website for a client that will be deployed across multiple physical locations. The site will be hosted from a corporate NOC, and administered by the IT group there. ...
0
5272
by: Eniac | last post by:
Hi, I've been working on a custom user control that needs to be modified and the validation is causing me headaches. The control used to generate a table of 4 rows x 7 columns to display all...
0
3177
by: EDBrian | last post by:
Problem: We enable our clients to create custom fields they wish to collect. We want to use Dynamic LINQ to query this table (Just one). My initial post and suggestion(s) are here:...
0
2697
by: tickle | last post by:
Need to convert this PL/SQL script to Dynamic SQL Method 2 * copybook - celg02u3.sql SIR 24265 * * updates dt_deny for all rows in * * ...
0
7202
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7330
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3167
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
380
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.