/    Sign up×
Community /Pin to ProfileBookmark

hi,

my doubt is,

i’m having a table with 3 rows and 3 columns and a button outside the table.

now.. by clicking the button the first row should be filled with text boxes( i mean one textbox in one cell, like that three textboxes).

now if i click once again the textboxes in the firstrow should be cleared and it should appear in the second row.

one more click second row’s textboxes vanishes and appears in the third row.

please help me solve this…urgent requirement, pls.

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@lakshmanMay 13.2003 — Hi All,

I used this technique to enter data in a table.

But, HOW do I retrieve the value of "myText"

var oTBody = document.getElementById("tableID");

var rows=oTBody.rows

var tblCells = rows[0].cells

Some of my last tries are :

alert (rows[0].namedItem("myText").value);

alert (rows[0].myText.value);

alert (tblCells[0].item(0).tagName);


I have tried for half a day and I am going mad.

Please...Please...Please Help
Copy linkTweet thisAlerts:
@lakshmanMay 14.2003 — Thanks for that Dave.

The following command does not work.

alert ("rows[0].id : " + document.frmTab.rows[0].id);


The following command works.

alert ("rows[0].id : " + rows[0].id);


Why and How???


Could you also tell me whether the following should work. I am getting "document.frmTab.rows.0 is null or not an object"

alert ("rows[0] : " + document.frmTab.rows[0].intitle.value);

The above alert is in line 255 under the function includeCustomerDetails().

If the above is correct then I can lnvestigate other parts of my file for errors.

I think the table is not created withing the form. Not sure..!!

I have attached my source file

you may, if you have time, search for "frmTab" & "tblAddresseeDetails_tBody" to validate that the table is within the form.


Please help....

[upl-file uuid=89cabd90-66f6-4629-adc9-8d94046eacd0 size=17kB]sgs.htlm.txt[/upl-file]
Copy linkTweet thisAlerts:
@lakshmanMay 14.2003 — Hi Dave,

Thanks for that response. Yes frmTab is the form Name, Here is the code snippet.

Note : addCust function adds a new row when the user hits a "add Cust Button"

When the user submits the form includeCustomerDetails gets called.

<body >

<form name="frmTab" method="post">

.

.

.

<table height=380 width=775 border=0>

<tr height=95% valign="top">

<td>

<table name="tblAddresseeDetails" id="tblAddresseeDetails_Id" striped="true" class=rowover border=1>

<thead BGCOLOR="lightskyblue" >

<tr >

<th width=50>Title</th>

<th width=205>Given Name</th>

<th width=320>Common Name</th>

</tr>

</thead>

<tbody id="tblAddresseeDetails_tBody">

</tbody>

<tfoot>

</tfoot>

</table>

</td>

</tr>

<tr>

<td>

<input name="btnAddCust" type="button" value="Add" onclick="addCust()">

</td>

<td>

<input name="customerString" type="hidden">

</td>

</tr>

</table>

.

.

.

</form>

</body>



<script language="JavaScript">

function addCust()

{

//alert("Add Cust Called");

var strTitle = '<input type="text" name="intitle" size="4">';

var strFName = '<input type="text" name="infName" size="30">';

var strCName = '<input type="text" name="incName" size="50">';

var oTBody = document.getElementById("tblAddresseeDetails_tBody");

oTR = oTBody.insertRow();

oTR.id = rowId++;

oTD = oTR.insertCell().innerHTML = strTitle;

oTD = oTR.insertCell().innerHTML = strFName;

oTD = oTR.insertCell().innerHTML = strCName;

}



function includeCustomerDetails()

{

document.frmTab.customerString.value="Mrs~Kumuthiny~Srilakshmanan|Mast~Krishna|Mast~Kanna";

//alert ("Called includeCustomerDetails");

var oTBody = document.getElementById("tblAddresseeDetails_tBody");

var rows=oTBody.rows

alert ("Pass 2");

alert ("rows[0].id : " + document.frmTab.rows[1].id);

//alert ("rows[0].id : " + document.frmTab.rows[0].intitle.value);

//alert ("tblCells[0] : " + tblCells[0].item(0).tagName);

//for(i=0; i < rows.length; i++)

//{

// document.frmTab.customerString += rows[i].strTitle + "~";

// document.frmTab.customerString += rows[i].strFName + "~";

// document.frmTab.customerString += rows[i].strCName + "~";

// document.frmTab.customerString += "|";

// }



// Remove the trailing "|"

//document.frmTab.customerString.substring(document.frmTab.customerString.length-1, document.frmTab.customerString.length);

//alert("List of Customer String : " + document.frmTab.customerString);

}

</script>





Any help will be much appreciated.
Copy linkTweet thisAlerts:
@lakshmanMay 15.2003 — Hi Dave,


Is that what you're trying to figure out? ...what field to reference for a particular table row?[/QUOTE]


Yes... Yes.. Oh Yes... Please..Please tell me the secret.

Lakshman
×

Success!

Help @saju_m spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...