Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Very specific FORM problem

    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

  • #2
    Senior Coder koyama's Avatar
    Join Date
    Dec 2006
    Location
    Copenhagen, Denmark
    Posts
    1,246
    Thanks
    1
    Thanked 5 Times in 5 Posts
    Quote Originally Posted by insomniak View Post
    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.
    Quote Originally Posted by insomniak View Post
    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.

  • #3
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by koyama View Post
    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.

    Quote Originally Posted by koyama View Post
    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

  • #4
    Senior Coder koyama's Avatar
    Join Date
    Dec 2006
    Location
    Copenhagen, Denmark
    Posts
    1,246
    Thanks
    1
    Thanked 5 Times in 5 Posts
    Quote Originally Posted by insomniak View Post
    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.
    Quote Originally Posted by insomniak View Post
    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.

  • #5
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •