2 Replies Latest reply: Nov 1, 2009 12:34 AM by BKBK RSS

    Problem with form display and linking fields.

    emartek1 Community Member

      I have two tables in my database (orders & product orders). Orders would have one record that could have many corresponding records in ProductOrders. The problem is two-fold.


      1) How do I present the ProductOrders page which consists of 4 drop down menus and 1 text field in a row so that users enter only as many orders as they need to. I dont want to display 20 rows of drop down menus only to have the user input only one order. Ideally I would like to have a way where the product orders page presents the first row and then once filled in would present another row, etc. Is this possible or is there a better way?


      2) How do I link the Orders.ID to the ProductOrders.OrderID on my submission form? I thought I would display the two pages together using a cfinclude but am unclear how the ID's will be linked. They should all be the same number ie: Orders.ID = 24 then all productorders.OrderID would be 24 too.


      I hope I'm making sense! Thanks in advance!!

        • 1. Re: Problem with form display and linking fields.
          mega_L Community Member

          You may need to provide some codes

          • 2. Re: Problem with form display and linking fields.
            BKBK MVP

            I agree with you. Twenty dropdown lists on a single page is too much.


            To go by your description, I would create distinct product pages, say, productPage001.cfm,  productPage002.cfm,  productPage003.cfm, and so on. Then I would put 4 dropdown lists per form per page, and use a table -- even, better, use div and CSS -- to display them in a row.


            You could pass the orderID from form/page to form/page as a hidden form-field or as a session variable. Include links (and appropriate Javascript for form submission) on each form/page to proceed to the next, or to the previous, page. Alternatively, use submit buttons.


            This also immediately suggests you could apply cfform's preservedata attribute to preserve the selected values in the form fields. You could also use session variables or a database to store the selected values.