Is it possible to submit multiple forms with one submit button?

瀏覽次數:136 次
跳到第一則未讀訊息

Lamps902

未讀,
2012年11月3日 上午10:44:062012/11/3
收件者:web...@googlegroups.com
I have a grid in which I'd like to put a form between each column header/label. Is it possible to submit and pass the data from all of these forms with a single submit button? Tried a couple of jquery solutions, but it wasn't quite working out.

Alternatively, is it possible to make a single form and split its input fields among the column headers?

Thanks.

howesc

未讀,
2012年11月4日 上午11:41:582012/11/4
收件者:web...@googlegroups.com
i suspect there are a couple of options here, though i encourage you to think carefully before implementing them (i assume that there is good reason why forms still work the way they do).

 - you can create a button with an onclick action that will collect data from various input fields and post it to the server in one or more AJAX calls
 - sure you can create one large form, but you'll need to carefully name all the input fields so that you know what is what.

Lamps902

未讀,
2012年11月4日 晚上11:09:462012/11/4
收件者:web...@googlegroups.com
Thanks. Took care of it by having a form with a submit button and a bunch of hidden fields, and a bunch of forms with a single input field, in the headers. When the "submit' button is pressed on the form with the hidden fields, the values from the other forms are copied to its corresponding fields, and all of the necessary vars are passed via "get." So that's basically how I went about implementing a multi filter with input fields under the headers for web2py's grid, though I'm sure there's a better way...

-Lamps
回覆所有人
回覆作者
轉寄
0 則新訊息