This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Problem in hiding the row of data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Problem in hiding the row of data" Watch "Problem in hiding the row of data" New topic
Author

Problem in hiding the row of data

Revanth reddy
Ranch Hand

Joined: Oct 10, 2008
Posts: 52
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
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
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

Joined: Oct 10, 2008
Posts: 52
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
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Are you cached? Have you debugged to make sure it is going into the if statement?

Eric
Revanth reddy
Ranch Hand

Joined: Oct 10, 2008
Posts: 52
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
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem in hiding the row of data