• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Help with update

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I am developing an application where in i have 30 rows from the mysql database for a calender month. one of the field is read-write,so i have 30 update buttons. Now when a user updates (for ex:24th record's read-write field), i need to update the same on the database. But i am confused how to map the update to the corresponding records.
i have attached the image of the JSP.
in the attached image, requested field is read-write field. if the user updates that field for any particular date then that update has to be reflected on the database.
Please advise how to go on.
Thanks in advance.
jsp1.JPG
[Thumbnail for jsp1.JPG]
Snapshot -Attachment
 
Sheriff
Posts: 7134
1360
IntelliJ IDE jQuery Eclipse IDE Postgres Database Tomcat Server Chrome Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"exxor user" please check your private messages regarding an important administrative matter.
 
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can create each row as a separate HTML <form> with a hidden field which includes the row identifier (I'm sure there are lots of other ways to do something simailar). However, in a broader sense, what happens when a user updates values from multiple rows? How are they going to know they must press the update button after each change? This does not seem intuitive from a UI point of view.

Instead, why not create a single HTML <form> which contains one set of fields for each row (dynamically create the fields) where the field name contains the information you need to locate the row. Then you just need one update button, and the user can make edits to their heart's content, then click the update button when finished.
 
Jaidev Arer
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Mark.
Here its a day to day activity were user changes that particular field only when they require.if they change multiple column, yes they have to press update for the corresponding row.
i am stuck up at that point, how to hook up the row to the particular update button.
Please do advice.
Thanks again.
 
Ranch Hand
Posts: 493
Android Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Instead, why not create a single HTML <form> which contains one set of fields for each row (dynamically create the fields) where the field name contains the information you need to locate the row. Then you just need one update button, and the user can make edits to their heart's content, then click the update button when finished.



I recommend this UI design too for your page...
 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jaidev Arer wrote:Thanks Mark.
Here its a day to day activity were user changes that particular field only when they require.if they change multiple column, yes they have to press update for the corresponding row.
i am stuck up at that point, how to hook up the row to the particular update button.
Please do advice.
Thanks again.



So you think the users will only change the value for the day they are interested in?
From experience I can tell you, you're in for a lot of trouble with that UI.

In any case, if you make each row/submit button a separate HTML Form, then just add a hidden field to the form which provides the identification information.

If you have a single HTML form/submit button with all the data rows in it, just change the name of the value field to include something that will allow you to identify it. For example, field_ROW1, field_ROW2, etc. Note: This is the name of the field, not the field's label.

There's probably many other ways you can accomplish this as well.
 
Jaidev Arer
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Mark.
We changed our design. We made a single update button in the new page we gave the option to select the date and the interested field and just one update button. That has made our life simple.
Thanks for the input.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jaidev Arer wrote:Thanks Mark.
Here its a day to day activity were user changes that particular field only when they require.if they change multiple column, yes they have to press update for the corresponding row.
i am stuck up at that point, how to hook up the row to the particular update button.
Please do advice.
Thanks again.



Hi

Actually this can be done as follows:

1> Keep 2 Dimentional javascript array for every row like [rowId][index of column i.e. field] which will be populated on page load
2> For every filed in a row, which can change, call a Java script functin say change(rowid,index of column)..On onchange event of correosponding field...change correosponding value in 2 dimentional array...
3> On every Onclick of update button you can call Ajax call to update correosponding row.

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic