We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14930
    • 70 Posts
    A client of mine wants a sort of simple-ish order form. I was thinking about using ditto to display his products and eform to handle the form and send the email.

    So basically what I want to do is this:
    - have a page with the form on the left hand side and the listed products (simple with Ditto) on the right
    - have a checkbox for every product (along with maybe a variable or two, like color or size)
    - have eform get the product name/number and the possible variables from the dittoed list

    I’ve used both eForm and Ditto before but not together. Tried to search the forums but couldn’t really find any info about using Ditto _in_ eForm. How would you go about doing this? Or should I consider this (Flat File Shopping Cart @ http://modxcms.com/forums/index.php?topic=18275.0 ) Thanks again for your support.
      • 25663 MODX Staff
      • 12,272 Posts
      I think the best way is to just try it and see if you start making headway. If you run into an unexpected problem then revisit here for support.
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 14930
        • 70 Posts
        Thanks for the reply, rthrash.

        As I found out with my earlier bouts with ditto and eform, this too was surprisingly easy to get to work. Just had to call [[ditto]] in the middle of the eform and have the input type="checkbox" name="[+id+]" value="[+pagetitle+]" eform="[+pagetitle+]::1"/ tag in the product documents. First I tried it with [!ditto!] but that only displayed the code, didn’t actually do anything.

        Now I’m off to tweak it, will let you know how it goes.
          • 14930
          • 70 Posts
          Everything is going well except for one thing: how do I keep the right hand side (product list) checkboxes checked if the user doesn’t fill a required field and the form displays an error message? All the info in the form itself (left hand side) stays there but the checkboxes become unchecked.
            • 33337
            • 3,975 Posts
            I think u need eform="[+pagetitle+]::1" only with first item in the checkboxes.

            Also name="" should be same per set.

            Hint: use tplFirst for the different first item.
              Zaigham R - MODX Professional | Skype | Email | Twitter

              Digging the interwebs for #MODX gems and bringing it to you. modx.link
              • 14930
              • 70 Posts
              Thanks for your help, zi, care to elaborate? I’m a bit confused right now: I’m using the checkbox name="[+id+]" tag because I use the IDs of the products on my eFeedbackReport chunk to list them. Is there easier way? To possibly list document IDs 5-39 according to what user has selected, without having to have the tag of every item in the chunk? Don’t know if I’m making any sense. I have a feeling that I’m doing things the hard way.. smiley
                • 33337
                • 3,975 Posts
                
                <label for="variableName_01">
                	<input type="checkbox" name="variableName[]" id="variableName_01" value="Label" eform="Instruction Text::1" />
                	Label</label>
                <br/>
                <label for="variableName_02">
                	<input type="checkbox" name="variableName[]" id="variableName_02" value="Label" />
                	Label</label>
                <br />
                <label for="variableName_03">
                	<input type="checkbox" name="variableName[]" id="variableName_03" value="Label" />
                	Label</label>
                <br />
                <label for="variableName_04">
                	<input type="checkbox" name="variableName[]" id="variableName_04" value="Label" />
                	Label</label>
                <br />
                <label for="variableName_05">
                	<input type="checkbox" name="variableName[]" id="variableName_05" value="Label" />
                	Label</label>
                


                Use [+variableName+] in the report.

                Try to replicate the above code. It should help. If not, just ask and I’ll try to explain. smiley
                  Zaigham R - MODX Professional | Skype | Email | Twitter

                  Digging the interwebs for #MODX gems and bringing it to you. modx.link
                  • 14930
                  • 70 Posts
                  zi, thanks for your help, I got it to work. But (as always when you are learning something new) another question arises:

                  I also have a dropdown menu next to the checkboxes (the checkbox selects the product, the dropdown allows the user to order multiple articles of the product. Right now I’ve been able to get it to display it in the report like this:

                  Product 1, Product 2, Product 3, # of articles for Product 1, # of articles for Product 2, # of articles for Product 3

                  But I’d like to get it to display like this:

                  Product 1: # of articles, Product 2: # of articles.

                  Can this be done?
                    • 14930
                    • 70 Posts
                    Quote from: jsor at Apr 24, 2009, 06:19 AM

                    Everything is going well except for one thing: how do I keep the right hand side (product list) checkboxes checked if the user doesn’t fill a required field and the form displays an error message? All the info in the form itself (left hand side) stays there but the checkboxes become unchecked.

                    Does anyone have any ideas about this? eFormOnValidate?
                      • 33337
                      • 3,975 Posts
                      Quote from: jsor at Apr 27, 2009, 02:03 AM

                      zi, thanks for your help, I got it to work. But (as always when you are learning something new) another question arises:

                      I also have a dropdown menu next to the checkboxes (the checkbox selects the product, the dropdown allows the user to order multiple articles of the product. Right now I’ve been able to get it to display it in the report like this:

                      Product 1, Product 2, Product 3, # of articles for Product 1, # of articles for Product 2, # of articles for Product 3

                      But I’d like to get it to display like this:

                      Product 1: # of articles, Product 2: # of articles.

                      Can this be done?

                      I think changing the order in the markup will take care of it.

                      eg.
                      checkbox code.
                      dropdown code
                      checkbox2 code
                      dropdown2 code
                        Zaigham R - MODX Professional | Skype | Email | Twitter

                        Digging the interwebs for #MODX gems and bringing it to you. modx.link