This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
I have an HTML page that displays 5 buttons using the form tag. Each of these buttons start a different servlet that returns some database information to me. I would like the user to be able to put in a date range so I have added 2 text field. One for FromDate and the other for ToDate. What I need to know is how to pull data from those fields for all the buttons. I don't want to have to have text fields for each button. Here is my HTML code.
One way is to add 2 hidden fields to each form and populate those before the form submission. Something like onsubmit="populateHidden(startDate,endDate);" You could do similar trickery with a querystring, using HTTP GET rather than post. Hope that helps! [ May 10, 2002: Message edited by: Brian Glodde ]
I understand what you are saying, but could you show me? I mean, where do I put the onsubmit=" " and what is the format for the hidden fields?
Joined: Jun 27, 2001
Greg, Here's one done for you. I will warn you, I did this quickly in IE, the syntax is definitely wrong for NS. You'll have to branch it to document.layers for that.
* the eval statement causes an error with UBB, so I am using "e v a l". For the subsequent forms, you'll just change the arguments to match. The next form would be onsubmit="return setDates(1, 'ATickets');" Happy coding!
I don't mean to be overly critical but are you sure you're going about this the best way, doing it all with lots of forms? Why don't you have one form and have a servlet that then directs the flow of control to the appropriate method or another servlet, depending on which button was pressed? That way you only need one form, one set of dates and you're even starting to do MVC design. Adam
I have seen things you people would not believe, attack ships on fire off the shoulder of Orion, c-beams sparkling in the dark near the Tennhauser Gate. All these moments will be lost in time, like tears in the rain.