...

View Full Version : Very specific FORM problem



insomniak
06-27-2007, 01:26 PM
Hi all,

Here is what I have : several forms (dynamically built, unknown number), each having it's submit button. Let's say these are our offers, each of them having several options (different cars, with options for color, extras and etc.).

I need to also put INSIDE these forms a checkbox so that I can compare DIFFERENT car offers. No I know it is not possible to nest forms. I know that most probably there is a very nice solution using JavaScript, but this functionallity needs to work with JS disabled.

The only idea I had is to put labels, each of them linked to another form, that has checkboxes for all the offers and a submit button. This actually works perfectly, but only if the label is text. I need it to be a checkbox, and when I nest a checkbox in the label tag it works in Firefox only :(

So ... any ideas? Besides the obvious one - use a single form and submit ALL the offers (which I find to be a very ... ugly descision).

Thanks,
Tihomir

koyama
06-27-2007, 06:30 PM
The only idea I had is to put labels, each of them linked to another form, that has checkboxes for all the offers and a submit button. This actually works perfectly, but only if the label is text. I need it to be a checkbox, and when I nest a checkbox in the label tag it works in Firefox only :(
I have never thought about such as solution. However, if I understand you correctly then that other form must be a form having display: none or being hidden by some other means. If this is the case then there may be problems getting the page to degrade nicely when styles are disabled. I think that this is important too.

So ... any ideas? Besides the obvious one - use a single form and submit ALL the offers (which I find to be a very ... ugly descision).
I'm not really sure why you think that this is an ugly solution. True, you will be sending redundant data back to the server since you need to send all the data from “both forms”, but this may only be a minor drawback.

But no matter which solution you choose there is another problem trying to “nest forms” each having its own submit button. What happens when you hit the enter button when focus is on one of the input fields (for example a checkbox)? Which form should be submitted? The browser has no way of telling this. (I am not even sure what happens in the various browsers). You would have to use JavaScript to control what should happen. But then, again, the page won't be fully functional with JavaScript disabled.

At the moment, I still think that using a single form is the best solution with that added layer of JavaScript to control form submission when the “enter” button is hit. But I too would like to hear about a good solution to this problem.

insomniak
06-27-2007, 08:04 PM
I'm not really sure why you think that this is an ugly solution. True, you will be sending redundant data back to the server since you need to send all the data from “both forms”, but this may only be a minor drawback.
This is the problem - there are not *TWO* but many forms. To be more precise - I've debugged our application and sometimes more than 300 offers are returned. This mean that each option is sent 300 times, and each new option added to the offers is sent 300 times ... you get the picture. It is not only a performance issue, I find this ... a wrong approach to the whole problem.



But no matter which solution you choose there is another problem trying to “nest forms” each having its own submit button. What happens when you hit the enter button when focus is on one of the input fields (for example a checkbox)? Which form should be submitted? The browser has no way of telling this. (I am not even sure what happens in the various browsers). You would have to use JavaScript to control what should happen. But then, again, the page won't be fully functional with JavaScript disabled.

True. I agree form nesting is dangerous. But there should be an easy workaround for my problem. I find this a design flaw of the HTML forms ...

Anywayz I need a way to both be able to send only part of the information on the screen AND still be able to compare two different offers. Other (non applicable) suggestions I received are : another form, whose input fields are displayed, using CSS, over the offers (not a good idea because positioning the elements would require a great amount of coding as the information is dynamic). There is a rather simple solution if I use a table and I put the "comparison" form in one column and all of the offers in another, but this I am unable to do because of our overall application design.

So ... still would appreciate ANY thoughts :) Thanks

koyama
07-01-2007, 06:52 PM
Other (non applicable) suggestions I received are : another form, whose input fields are displayed, using CSS, over the offers (not a good idea because positioning the elements would require a great amount of coding as the information is dynamic).
The idea seems alright, but you may be facing limitations within CSS as to what extent it is possible to shift around with elements on the styled page.

There is a rather simple solution if I use a table and I put the "comparison" form in one column and all of the offers in another, but this I am unable to do because of our overall application design.
I am not even sure that this is possible. How would you put a form in one column?

Maybe you could show us the page in question. I'm not sure whether you're taking about “truly separate forms” or “entangled forms” with shared input elements.

insomniak
07-05-2007, 04:58 PM
Unfortunately I am really pressed by the tight timeline and I need to abandon the search for solutions. I will stick to the idea of using one single form for all the data (as much as I resent it I currently have no other workarounds).

Thanks koyama for your help.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum