We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 54524
    • 34 Posts
    Still a blank page.
    I don't know anything about php.
    So I hope we can make it work.
      • 46886
      • 1,154 Posts
      I am sorry I don't think this is the right direction.

      If I understand it, the data is already there, haven't we agreed about that? You've got the right tpl, I was wrong about that, it does work you've proven it. And you say the output is all there. FormIt is working, I think this is clear by now. There is no sense in building it all again.

      You said you want two things, the contact info separated from the orders, and the zero orders stripped out.

      For the contact info issue, pls find the tpl called tLoadlist and paste it here so we can see how it outputs. That's not the email tpl but it is the output tpl. That will control how the output looks, and we will know the names of the values. We should be able to see the contact info call and move it where you want.

      It would also be better if you gave your full form, so we can see the values used in the form to save, but the tpl will probably have the same values and we can probably guess what they are.

      Also, pls provide the code of the snippet called FormItSaveForm, which is the snippet that does all of this. That snippet does work, we've proven that it does output the right data.

      This is your code with the tpl name and snippet name.

      [[!FormIt?
      &validate=`[[!getImageList? &tvname=`Bestellijst` &tpl=`tLoadlist` &outputSeparator=`,`]]`
      &hooks=`spam,email,FormItSaveForm`


      For the removing of the null results, I suggest using an output modifier, using this model

      [[+numbooks:lt=`1`:hide]] 


      and I think this should work

      [[+fields:lt=`0`:hide]]


      However it might be necessary or better to check the tLoadlist file, that might be better for limiting the null results because we can limit just the product fields.
        • 54524
        • 34 Posts
        Thanks again.
        Sorry for the late response, have been busy.

        Totally agree with what you're saying.

        I'll try to give you a good overview of it all.

        tLoadlist:
        <li>
        <p>
        <strong>[[+title]]</strong>
        		[[+description]]
        		[[+price]]
        </p>
        
        <select name="product_[[+title]]">
                <option value="0">0</option>
                <option value="1">1</option>
                <option value="2">2</option>
                <option value="3">3</option>
        </select>
        </li> 
        


        The form itself:
        <div id="contact-form">
        <form name="contactform" id="contact" action="[[~[[*id]]]]" method="post">
        <fieldset> 	
        
        	[[!+fi.validation_error_message:notempty=`<div class="alert alert-error">[[!+fi.validation_error_message]]</div>`]]
        	[[!+fi.successMessage]]
        
        	<div id="productenlist">
        		<h3><br>Warme Gerechten</h3>
        		<ul>[[getImageList? &tvname=`WarmeGerechten` &tpl=`tLoadlist`]]</ul>
        		<h3><br>Burgers</h3>
        		<ul>[[getImageList? &tvname=`Burgers` &tpl=`tLoadlist`]]</ul>
        		<h3><br>Dranken</h3>
        		<ul>[[getImageList? &tvname=`Dranken` &tpl=`tLoadlist`]]</ul>
        		<h3><br>Warme Broodjes</h3>
        		<ul>[[getImageList? &tvname=`WarmeBroodjes` &tpl=`tLoadlist`]]</ul>
        		<h3><br>KoudeBroodjes</h3>
        		<ul>[[getImageList? &tvname=`KoudeBroodjes` &tpl=`tLoadlist`]]</ul>
        		<h3><br>Salades</h3>
        		<ul>[[getImageList? &tvname=`Salades` &tpl=`tLoadlist`]]</ul>
        		<h3><br>Snacks en Frites</h3>
        		<ul>[[getImageList? &tvname=`SnacksFrites` &tpl=`tLoadlist`]]</ul>
        	</div>
        	
        	<input type="hidden" name="inputChecker" value="" />
        	<input type="hidden" name="contactFormIt" value="1" />
        
        	<label for="naam">Name</label>
        	<input type="text" id="naam" name="naam" placeholder="full name" title="Enter your name" class="required" value="[[!+fi.naam]]">
        	
        	<label for="naam">Company</label>
        	<input type="text" id="bedrijf" name="bedrijf" placeholder="company name" title="Enter your name" class="required" value="[[!+fi.bedrijf]]">
        	
        	<label for="email">E-mail</label>
        	<input type="email" name="email" placeholder="[email protected]" title="Enter your e-mail address" class="required email"  value="[[!+fi.email]]">
        
        	<label for="bericht">Message</label>
        	<textarea  id="bericht" name="bericht">[[!+fi.bericht]]</textarea>
        	<input type="submit" class="button" value="Send Message"> 
        </fieldset>
        
        </form>
        </div>


        The codes above work, the question is how to get the information in an email.

        See the attachments for the other snippets.
        It's php so I don't really know...
        I can copy the full code but this gives you a quick overview of what is is about.
        There is a snipped called 'FormItIsSelected', seems like I need to use this?

        I really don't know anymore.

        Let me know what you're thinking!
          • 54524
          • 34 Posts
          Oh I forgot about the bottom part of your post.

          [[!FormIt?
          &validate=`[[!getImageList? &tvname=`Bestellijst` &tpl=`tLoadlist` &outputSeparator=`,`]]`
          &hooks=`spam,email,FormItSaveForm`

          I removed the &validate part. Do I need to use this?

          [[+numbooks:lt=`1`:hide]]
          [[+fields:lt=`0`:hide]]
          I think I can try this when we get it working.
          Still not there.

          Looking forward for your reaction.
          I cannot think clearly anymore about this problem
            • 46886
            • 1,154 Posts
            Oh wonderful! I didn't know how you would take that comment. I am sorry I didn't read the code right earlier, should have asked for more pieces forever ago.

            Ok, so I think you have learned a lot! And you know your way around your system. And I think we are all going to learn a little about php haha.

            Now I think we should start with this tpl, this is the tpl for the contact form itself, on your webpage

            <li>
            <p>
            <strong>[[+title]]</strong>
                    [[+description]]
                    [[+price]]
            </p>
             
            <select name="product_[[+title]]">
                    <option value="0">0</option>
                    <option value="1">1</option>
                    <option value="2">2</option>
                    <option value="3">3</option>
            </select>
            </li> 



            If you wanted to provide more information or insert something in there, to be shown on every product box, like later maybe you could have a tv to provide whether that product had discount or not.

            Ok next is probably the 'FormItLoadSavedForm', it looks like it is getting the data all ready so it looks good, but I can't be sure. It is not sending out an email, I feel pretty sure. It would have to be called by the email snippet in FormIt

            With Modx, it is possible in php to call an html chunk form, and output the data with precision, but I don't know if that would happen here or in the email snippet of Formit. Is the email snippet default or custom? This is quite possibly the place to limit the output I think, at least possible.

            But, another way might work as well, could you stick the following code into the tpl and see if you get the output?

            <p>[[+bedrijf]]</p>
            <p>[[+naam]]</p>
            <p>[[+bericht]]</p>

            That should call the fields by name, but you may see a doubling of them, have a try and see.

            Oh, and did you try the limiter to see if it would strip the empty fields away? Did it work? [ed. note: nuan88 last edited this post 5 years, 8 months ago.]
              • 46886
              • 1,154 Posts
              I'm going to make a parallel thread, but let's keep going in this one to narrow things down and figure it out.

              By now I feel we know pretty much the values, when it outputs it just does it all in 'fields' but it doesn't have to be called all at once like that either.

              Let me know about the results of those bits of code above, and the removing of the null values so you dont get 30 every time.
                • 54524
                • 34 Posts
                Not sure if I have learned a lot, already created so many websites with this system.
                Just need to learn the solution for the problem haha.

                I don't think that FormitLoadSavedForm is interesting at this point.
                Because it says: Prehook to load previously saved form.

                The email snippets are default.
                I didn't create it, but I can change it if I want.

                Already had these codes in the tpl, works fine, I get it correctly in the email. I see it only once.

                I just replaced the defaultemailtpl for [[+fields:lt=`0`:hide]], but still get the same result. A full list of all the fields.

                I don't know what to do with this? [[+numbooks:lt=`1`:hide]]

                Thanks so much!
                Really appreciate it!
                  • 46886
                  • 1,154 Posts
                  Can you try these?

                  <p>[[+bedrijf]]</p>
                  <p>[[+naam]]</p>
                  <p>[[+bericht]]</p>
                    • 54524
                    • 34 Posts
                    Quote from: nuan88 at Sep 02, 2018, 10:09 PM
                    Can you try these?

                    <p>[[+bedrijf]]</p>
                    <p>[[+naam]]</p>
                    <p>[[+bericht]]</p>

                    I did, but as I have told before, this always works.
                      • 46886
                      • 1,154 Posts
                      Ok good, so let me make a simple email:


                      <p>User [[+naam]] has placed an order with the following contact information:</p>
                      <p>[[+bericht]]</p>
                      <p>[[+bedrijf]]</p>

                      and then, for the product info, I found two modifiers that might work to strip those empty orders, please give both of them a try, the first one seems more likely to me:

                      <p>[[+fields:notempty=`[[+fields]]`]]</p>

                      <p>[[+fields:stripString=`0`]]</p>