?
Solved

get change textbox value only

Posted on 2006-10-31
7
Medium Priority
?
300 Views
Last Modified: 2010-04-01
Hi

I have a senario where I am try to get values from 100 records and each record has 10 columns (10 values).
form look like grid layout with 10 columns and 100 rows.
Problem is when values are retrived and displayed in the form most of them are null. and user will update the values from the form.
Everytime when user clicks on update 100 records will be getting updated. but let say user changes only 2 records(rows) and clicks on update it will send 100 records(1000 values to database) and number of changes 2 records(20 values).
This will make process slow.
My question is there anyway I can save only the changed values and update the records insted of sending all values.

capture changes and update database.

Thanks
0
Comment
Question by:basirana
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 9

Expert Comment

by:owenli27
ID: 17842198
You may need to implement AJAX into your code.  There are demo and some sample codes at this links  http://ajaxtags.no-ip.info/  
You also can easily find other AJAX Sample applications on Web.
0
 
LVL 10

Expert Comment

by:jaggernat
ID: 17843117
>>>>. but let say user changes only 2 records(rows) and clicks on update it will send 100 records

Change the backend logic .i.e. once the user changes(updates) the fields in front-end, in the database, update  only those fields which were Changed in front-end. Those fields which were not changed , should not be updated in database.
0
 
LVL 19

Expert Comment

by:Kuldeepchaturvedi
ID: 17844533
you can use a hidden form field on every record and then use java script to update this value when user changes anything on the record.
at the back end you can check this hidden field to determine which records needs updation in the database...
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 10

Expert Comment

by:jaggernat
ID: 17844742
true, just like setting a flag for the field!
0
 
LVL 19

Expert Comment

by:Kuldeepchaturvedi
ID: 17844775
:-) I have used this trick more than I can care to remember.
0
 

Author Comment

by:basirana
ID: 17845041
Can I get example how can capture changes
0
 
LVL 19

Accepted Solution

by:
Kuldeepchaturvedi earned 2000 total points
ID: 17849383
on your display jsp....
add another hidden input parameter in your table...

i.e.
if you have
<TR>
<TD>data1</TD><TD>Data2</TD>...... add <TD><input type=hidden name="sw<%=i%>" value="0"></TD>
//here I am assuming that your table is getting created in some kind of loop & i is the counter of the loop.

now on every element you will have to add this script "onChange=setSw('sw<%=i%>');

write a small javascript function

function setSw ( switch)
{
document.getElementbyId(switch).value="1";
}

now in your back end code...

for(int i=0; i<100; i++)
{
if(request.getParameter("sw"+i).equals("1")
{
//need to update this row..
}
else
{
// skip the row..
}
}
}

there are other ways of accomplishing the same thing.. I have tried to put in the most basic approach.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this modest contribution, I want to share with the IT community (especially system administrators, IT Support Engineers and IT Help Desks) about Windows crashes/hangs and how to deal with these particular problems.
This month, Experts Exchange’s free Course of the Month is focused on CompTIA IT Fundamentals.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question