• 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

Problem in hiding the row of data

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello guys,
First of all i wish you happy and prosperous new year to all javaranch team.

here is my problem::

i am displaying some rows of data from the db based on user input in a grid. each row in the grid has radio button, my requirement is when the user clicked on radio button i need to display 6 text boxes(infact these text boxes are nothing but the column names of the grid )with the actual values, so that user can update these values and hit on update the updated values to be reflect the db.

i am able to pull the rows from db and displaying on the grid, when the user clicks on first radio button i am able to display the first row of data in the text boxes, when the user clicks on second row of data i am able to display the second row of data in the text boxes, but here i want to hide the first row of text boxes. currently i am displaying all the rows in the textboxes(At any given point of time i have to display the one row of text boxes based on user click on the radio button, if user clicks on 1st radio button display first row in text boxes, if user clicks on 2nd row , then hide the first row of text boxes and display the 2nd row of text boxes)

one more problem is if user updates some values in the text boxes how to send the updated values to the action. to perform db update( i am using struts frame work with dispatch action)

here is my jsp



Any help is greatly appreciated
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is not that hard, just keep a reference to the last row.



How to save the values, Post back the form and save or use an Ajax call if you do not want to submit the page.

Eric

[Edit notes: Fixed the bug]
[ December 31, 2008: Message edited by: Eric Pascarello ]
 
Revanth reddy
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Eric Pascarello:
It is not that hard, just keep a reference to the last row.



How to save the values, Post back the form and save or use an Ajax call if you do not want to submit the page.

Eric

[ December 31, 2008: Message edited by: Eric Pascarello ]



Eric,
Thank you somuch for your time.
i replaced my javascript funtion with yours, but still i am able to see the multiple rows of text boxes, it is not hiding the older ones.

Thanks
Kumar
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you cached? Have you debugged to make sure it is going into the if statement?

Eric
 
Revanth reddy
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Eric Pascarello:
Are you cached? Have you debugged to make sure it is going into the if statement?

Eric




Eric,
i cleared the cache, lets say i have 2 rows in the grid. when the page is loaded the grid has 2 rows and each row has a radio button. when i click on firstrow radio button for the first time it is going to second if.

then if i click on the second row raio button it is going to first if with lastindex is set to 0(which is id) and also it is going to second if with lastindex is set to 1.

i am bit confused.
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I see the bug in my code.

Look at what variable I used in the if statement. That will tell you why it is not hiding.

See what happens when I type code into the textarea on the forum!

Eric
 
reply
    Bookmark Topic Watch Topic
  • New Topic