Click to See Complete Forum and Search --> : multiple forms on a page
bryce4president
10-12-2007, 05:02 PM
I have a page that loads a varying number of forms. It could be 1 form, 2 forms or more. I dynamically create them based on conditions. Each form has a button for submission. When the user picks which button to click I need to send a specific set of values over to the next page. I just need to know which value is selected so that I can pass the right set of values.
is there a way to do this?
If i only create one form it will work just fine, but if there are more forms it stops working..
Khalid Ali
10-16-2007, 11:22 AM
1. wrong forum (post it in JavaScript or HTML)
2. bad idea to have multiple forms on a single page
3. they probably fail because all of the elements have the same names.
bryce4president
10-16-2007, 11:30 AM
Hey Kahlid,
I got it to work with a mixture of Java and Javascript. The java was used to dynamically build my page code which then, once written used javascript to submit the proper form.
I was dynamically building a table based on data in an SQL resultset and I was making a button next to the order number so that when you clicked that button, it would take you to that order's information based on which button you clicked. But since the button was inside of a <td> tag I just made a form in each one and did the submit.
Is there a better way of handling this? I need to be able to advance to the next screen of a particular order. I'm new to web development. How do the designers usually handle this situation? I first built a link dynamically but didn't like the idea of passing parms through the url. And doing a form post was the only way I could think of to hide it.
Any thoughts?
Khalid Ali
10-16-2007, 06:59 PM
well form post is probably a better choice for sure. When u click on the button, does it load the next page in the current window?
I want to understand the need to have multiple forms on a single page....
bryce4president
10-17-2007, 08:23 AM
Yes, it loads a new page in the current window. And I need to pass along the order number and a couple of other values that I have already computed that I don't want to recompute. And use some of that information to do an sql query on that next page.
On the current page, with multiple forms I load a table based on an SQL result set from our db. Each order gets it own row in the table. The table has a fixed header and is scrollable. It took me some time and a lot of googling but I finally got it to work right. It is a 1 table solution to the fixed header scrollable body. Pretty nifty. but i digress.
Basically, each row is unique, and I need a way to pass the information onto the next page based on the order they choose, i'm just looking for the best way to do it. Right now I load a cell to the left of each order number that is a form with just a button and a few hidden fields. When the page loads I generate a unique Id value for the form, and pass a corresponding index value (row number) to a javascript function that submits the correct form.
Its a nice workaround, but I find it hard to believe that there isn't an easier way. I just don't know how people normally handle this type of problem.
Khalid Ali
10-17-2007, 09:12 AM
I think I know what you can do, but just be on safe side, if its possible post a screen shot of the page that has multiple tables on it
bryce4president
10-17-2007, 09:25 AM
9745
Here is a test example. There are only 2 rows, but I think you get the idea.
Setomidor
10-18-2007, 10:15 AM
Why not use ordinary links and provide the data within the links instead? Sure, it shows up in browser history, but that's not the end of the world...
bryce4president
10-18-2007, 10:25 AM
This is true. And that is how I originally had it. I was just trying to make it cleaner. Was searching for that holy grail. haha.
I have it working with multiple forms. Its pretty slick.