Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
Sheriffs:
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • fred rosenberger
  • Frits Walraven

getting previous value when using display:table

 
Ranch Hand
Posts: 279
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am using display:table to display a table in my jsp. It includes a radio button for the user to select that particular record. The record includes the date field.

So now I want to edit the record. So the user clicks the radio button and click edit. In the next page the user enters the date. But now I want to validate the date so that it is greater than the previous one. How can I do this.

One way I was thinking is using a hidden variable (previousDate, NextDate in the form) and get those values in the edit page. But how can I set the values for the hidden variables.

Any help is appreciated.

Thanks
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well you can use a hidden form element and reference it

<input type="hidden" name="prevDate" value="10/20/2006" />

you can reference that with:

var dPrev = new Date(document.formName.prevDate.value);
var newDate = new Date(document.formName.newDate.value);

if(dPrev>newDate)alert("wrong");

Eric
 
vjy chin
Ranch Hand
Posts: 279
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply and apologises for the late response.

Actually I was also thinking of using the hidden parameter. But how can I set the value for them.

So I have 2 hidden parameters. The user selects a value using the radio button. I need to populate the hidden parameter with the previous and next values of the selected radio button. I am not able to figure out how to set the values for the hidden parameter.

Hope I made myself clear.

Thanks again.
 
vjy chin
Ranch Hand
Posts: 279
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am still struggling to find a solution for this. Any help would be greatly appreciated.

Thanks.
 
vjy chin
Ranch Hand
Posts: 279
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

Finally I solved it. It seems that the should be in between the <display:column> tag.

This is what I did



I had a property previousDate in the bean and I populated it when getting the table values itself. Now I am able to get the values.

Thanks.
 
I knew I would regret that burrito. But this tiny ad has never caused regrets:
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic