473,387 Members | 1,391 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

extracting values from a dynamically created row

29
Hi

I have created a dynamic row and inserted the values into the cells of those rows from textboxes. Now I have to edit those values stored in the rows. At the end of each row created dynamically two buttons namely "Edit" and "Delete" are present. If I click the "Edit" button the values in that particular cells should go back to the textboxes for editing and then after editing it should go to the corresponding place.

Can any one help to solve this using Javascript.
Thanks in Advance.........
Jun 20 '07 #1
17 5513
cygsoft
29
Hi

I have created the table using an email id. The end of each row contains "Edit" and "Delete" options. If I click Edit Button of that particular row, The emailid should be transferred to other page for editing and then return back after modification to the previous page.

Thanks.
It would be so helpful for me.
Jun 20 '07 #2
r035198x
13,262 8TB
Hi

I have created the table using an email id. The end of each row contains "Edit" and "Delete" options. If I click Edit Button of that particular row, The emailid should be transferred to other page for editing and then return back after modification to the previous page.

Thanks.
It would be so helpful for me.
1.) Are you using JSP?
2.) Do you have each edit link in its own form? You can pass the email value as a hidden field of that form.
Jun 20 '07 #3
cygsoft
29
thanks for ur reply

I am creating a row dynamically in that email address, edit and delete buttons are there. For each row created dynamically the corresponding edit and delete buttons are also created.

If i click an edit button in a particular row the emailid in tht row should be extracted for modification.
Jun 20 '07 #4
r035198x
13,262 8TB
thanks for ur reply

I am creating a row dynamically in that email address, edit and delete buttons are there. For each row created dynamically the corresponding edit and delete buttons are also created.

If i click an edit button in a particular row the emailid in tht row should be extracted for modification.
You'll still need to tell us if you're using JSP or just Javascript.
How does the submiting work by clicking the edit button? You need a form to submit. Once you answer my initial questions, everything will become clear from then on.
Jun 20 '07 #5
cygsoft
29
You'll still need to tell us if you're using JSP or just Javascript.
How does the submiting work by clicking the edit button? You need a form to submit. Once you answer my initial questions, everything will become clear from then on.

It was in Javascript. "Edit" is not a submit button. It is generated dynamically when each new EmaiiId is added. Now when "Edit" is clicked the email ID should be brought for editing.

For each mailID added there is a corresponding "Edit" and "Delete" is present.
If any Edit or Delete of a particular row is clicked then the that row should be brought for modification. After modification the mailID should be send back to the same place.
Jun 20 '07 #6
r035198x
13,262 8TB
It was in Javascript. "Edit" is not a submit button. It is generated dynamically when each new EmaiiId is added. Now when "Edit" is clicked the email ID should be brought for editing.

For each mailID added there is a corresponding "Edit" and "Delete" is present.
If any Edit or Delete of a particular row is clicked then the that row should be brought for modification. After modification the mailID should be send back to the same place.
Then the question belongs in the Javascript forum and so I'll move it there.
Jun 20 '07 #7
cygsoft
29
Hi

here is my code.

<html>
<body>
<script>
function addRow()
{
var newRow = document.all("tblGrid").insertRow();
var oCell = newRow.insertCell();
oCell.innerHTML = f1.fullname.value;
oCell = newRow.insertCell();
oCell.innerHTML = f1.emailaddress.value;
oCell = newRow.insertCell();
oCell.innerHTML = "<input type='button' value='Edit' onclick='editvalidate(this);'/>&nbsp;&nbsp;<input type='button' value='Delete' onclick='removeRow(this);'/>";
}

function removeRow(src)
{
var oRow = src.parentElement.parentElement;
document.all("tblGrid").deleteRow(oRow.rowIndex);
}

</script>
<table id="tblGrid">
<tr><td></td></tr>
</table>
<form name="f1">
Fullname<input type="text" name="fullname"><br>
EmailAddress<input type="text" name="emailaddress"><br>
<input type="button" value="add" onclick="addRow();">
</form>
</body>
</html>





This coding works fine for deleting a particular row. But when i click the "Edit" button of the row created, I need those two values such as "name" and "emailaddress" to be brought back to the textbox and edited and then send back..

It would be so useful if anyone help me.
Thanks

by
sudha
Jun 20 '07 #8
cygsoft
29
this is needed urgently can anyone help pls.........
Jun 20 '07 #9
cygsoft
29
help needed urgently........
Jun 20 '07 #10
cygsoft
29
I have a table contains the email Id and edit and delete options.and i hava a create new button.If iclick the createnew button it goes to the jsp page it contains email Id text field.if we enter the email id and submit on that page control goes to the same page and i want to see the email id dynamically in that table the edit and delete options also created dynamically.if i click the edit option it goes to the entire email id page and i change the password information it will change the password and submit means it returns the same page.

if i click the delete option div should displayed,in that two options one is yes and another is no ,if i click yes that entire row will be deleted, if click no just div only deleted and then entire row will be delete while checked some checkbox

can u help me ...
thanks in advance.....
Jun 20 '07 #11
r035198x
13,262 8TB
help needed urgently........
There are several ways of doing this.
One way is to write the email in a hidden input for each row.
Jun 20 '07 #12
acoder
16,027 Expert Mod 8TB
Post what code you have so far so we can work with that.
Jun 20 '07 #13
acoder
16,027 Expert Mod 8TB
These seem to be on the same topic, so I've merged the threads.
Jun 20 '07 #14
acoder
16,027 Expert Mod 8TB
I've merged about 4 or 5 threads. Please keep all posts in one thread. It's very difficult if the posts are all in separate threads and you have 2/3 answers in different places.
Jun 20 '07 #15
acoder
16,027 Expert Mod 8TB
Hi

here is my code.

<html>
<body>
<script>
function addRow()
{
var newRow = document.all("tblGrid").insertRow();
var oCell = newRow.insertCell();
oCell.innerHTML = f1.fullname.value;
oCell = newRow.insertCell();
oCell.innerHTML = f1.emailaddress.value;
oCell = newRow.insertCell();
oCell.innerHTML = "<input type='button' value='Edit' onclick='editvalidate(this);'/>&nbsp;&nbsp;<input type='button' value='Delete' onclick='removeRow(this);'/>";
}

function removeRow(src)
{
var oRow = src.parentElement.parentElement;
document.all("tblGrid").deleteRow(oRow.rowIndex);
}

</script>
<table id="tblGrid">
<tr><td></td></tr>
</table>
<form name="f1">
Fullname<input type="text" name="fullname"><br>
EmailAddress<input type="text" name="emailaddress"><br>
<input type="button" value="add" onclick="addRow();">
</form>
</body>
</html>





This coding works fine for deleting a particular row. But when i click the "Edit" button of the row created, I need those two values such as "name" and "emailaddress" to be brought back to the textbox and edited and then send back..

It would be so useful if anyone help me.
Thanks

by
sudha
OK, now we have some code. Firstly, this is IE-only code. document.all should be document.getElementById.

Create a function, editvalidate which gets the current row and from that the first and second cells. cells[0] and cells[1] will refer to those cells. You can refer to the text boxes by e.g.
Expand|Select|Wrap|Line Numbers
  1. document.forms.f1.fullname.value=...
See how this example does it.
Jun 20 '07 #16
cygsoft
29
Thanks a lot.
The example you have given is very much useful.

I had worked out tht format using the following codings. I just share my codings here.

the codings for editing

function editvalidate(src)
{
var currObj = src;
while( (currObj.tagName != "TR") && (currObj.tagName != null) ){
currObj = currObj.parentElement;
}

var rowObj = currObj;
var cellCount = rowObj.cells.length;
var tdObj = rowObj.firstChild;
var colValues = new Array( cellCount );

for( i = 0; i < cellCount; i++ ) {
currObj = rowObj.cells[i];
while( (currObj != null) && (currObj.innerText == null) ) {
currObj = currObj.firstChild;
}
if( currObj != null )
colValues[i] = currObj.innerText;
}
var storename=colValues[0];
// var namelength=parseInt(strlen(storename));
var n=storename.length;
var removename=storename.substring(1,n-1);
document.f1.fullname.value=removename;

var storeemail=colValues[1];
var n1=storeemail.length;
var removeemail=storeemail.substring(1,storeemail.leng th-1);
document.f1.emailaddress.value=removeemail;



var oRow = src.parentElement.parentElement;
document.all("tblGrid").deleteRow(oRow.rowIndex);

}
Jun 21 '07 #17
acoder
16,027 Expert Mod 8TB
Thanks a lot.
The example you have given is very much useful.

I had worked out tht format using the following codings. I just share my codings here.
You're welcome. Glad you got it working fine.
Jun 21 '07 #18

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

Similar topics

6
by: steveneng | last post by:
C++ Primer Plus Programming Exercises 4th Ed - Prate Help I'm trying to refresh myself and I'm stuck on this problem (not homework/school related but for personal advancement). 6: Do...
3
by: Jen | last post by:
Hi I have created some controls (HtmlInputText, HtmlGenericControl, TextBox) dynamically. But I have problem getting the values from these controls to save them. Is there a way to do that? ...
4
by: Mark Broadbent | last post by:
This one has got me absolutely stumped. At work I have created a simple web form that gets data from a sql backend and puts this to a dataset. I have an edit button that when clicked will set...
4
by: Larry Grady | last post by:
Anyone up for a challenge? I've been struggling with this for a few days and was hoping someone could help me. Pouring through all the messageboards I just can't find the solution. We have a...
5
by: \A_Michigan_User\ | last post by:
I'm using asp.net/vb.net/ado.net to create a very simple user interface. (Everything works if I use STATICALLY created textBoxes... but not when I make them DYNAMICALLY.) 1. Execute a SQL...
2
by: Robert McEuen | last post by:
Sorry if this double-posts...Google doesn't do a very good job of communicating whether something has posted or not. Using Access 97, WindowsXP Is there a way to pass command line parameters...
16
by: Preben Randhol | last post by:
Hi A short newbie question. I would like to extract some values from a given text file directly into python variables. Can this be done simply by either standard library or other libraries? Some...
3
by: somaskarthic | last post by:
Hi How to get the values of dynamically created checkboxes which are checked and unchecked (for both the conditions). Only the selected checkbox values are posted as 'On' . How can i get the value...
2
by: assgar | last post by:
Hi Developemnt on win2003 server. Final server will be linux Apache,Mysql and PHP is being used. I use 2 scripts(form and process). The form displays multiple dynamic rows with chechboxs,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.