We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 54524
    • 34 Posts
    Nuan88: Since I am a designer I'm very good with css, so the styling won't be a problem at all. But the technical stuff is. In your example is nothing I don't know. For some reason we don't really understand each other, it probably is a different way of thinking as a designer and a programmer haha.

    One bizarre thing is that the default tpl works but a custom tpl doesn't. That is not completely true because fields like [[+name]] and [[+email]] always have worked. It's a little strange why [[+fields]] didn't, but there must be a reason for that I guess.

    Using [[+fields]] seems like a bad thing for me to do. I prefer having only the products with a higher value then 0 zero shown. Could I make that with using fields?

    If you're saying that that's the way to do it, I will. But I have a feeling that that is very unusual.

    I always make it way too complicated for myself, thanks for making it more simple haha!
      • 46886
      • 1,154 Posts
      Hi sorry I didnt know! Lol funny you are probably worlds better than me in css

      Ok let's drill down, because [[+fields]] may not be working at all. I think you may have found the wrong tpl file. There is no reason why there would be a difference in the output. So you can probably put your custom tpl file back in the code, can you output [[+title]] in your custom tpl format?

      According to LK, if you have this type of code which you shared with us:
      <select name="[[+title]]" id="[[+title]]" value="[[[[+title]]]]">
                  <option value="0"[[!+fi.numbers:FormItIsSelected=`0`]]>0</option>
                  <option value="1x" [[!+fi.numbers:FormItIsSelected=`1`]]>1</option>
                  <option value="2x" [[!+fi.numbers:FormItIsSelected=`2`]]>2</option>
      ...
              </select>


      Then you output that in your email like this
      [[+title]]
      , that's the name of the value you record in the above code. Its in the database and that place has the name 'title'. It may be a single value or multiple values, I am not sure yet. But definitely those have to match, the tool is getting the data and its got to know where it is.

      When you successfully got the output in your email, it was 3 items, isn't that right?

      Please go into the resource page that the checkbox is in, and scroll all the way down. You should have a tv attached to that resource (the page that you can view with the checkboxes). You should see several rows of data down there, which will be the items you've got in your output.

      I suspect you can put more items in the tv to get your full list. If that's true you will be fixed up pretty soon.

        • 54524
        • 34 Posts
        No problem, i didn't tell you haha.

        I'm pretty sure that its the right file, I tried [[+fields]] again several times but it is just not going to happen.
        When I try [[+title]] I see exactly this back in the email. But this refers to a MIGXTV, so this seems not the way to call for a TV list. I know that it needs to match but so far its not happening in my email.
        Already tried multiple titles and the outputs.

        No it's a long list of items, more then 30.

        Already have my full list, that's not part of the problem smiley.
          • 46886
          • 1,154 Posts
          Well you've got to find that tpl that does work, if you had that you would be golden.

          The confusing thing for me is, do you have multiple checkboxes for all the different items? I am wondering if you have all those series of checkboxes or not in your code.

          Your tv might be doing this all programmatically, meaning it can reuse the checkboxes and you won't have a lot list of code with multiple checkboxes. In that case its possible that the [[+title]] is actually how the tv sets up a list of items and goes through each one. I just don't know enough about how it works. And it seems that if the checkboxes save the value as [[+title]] then you would output them with the same code.

          Still, the default tpl is working, pls find that, then you can design your email and move forward. It has to be in there, in the formit chunks
            • 54524
            • 34 Posts
            It must be the fiDefaultEmailTpl which contains: <p>[[+fields]]</p>.
            What else can it be?
            What I see is basically all the fields, nothing else.

            Yes my tv is doing all this programmatically.

            Why can't anybody tell me how this works?
            It is so frustrated.

            No, I don't want a list of all the fields in my email tpl.
            I want the product items separated of the contact information.
            And I only want to show products with a higher value then zero.
              • 17301
              • 932 Posts
              Quote from: marielvdoever at Aug 28, 2018, 03:04 PM
              Thanks for your reactions!

              LK: I just tried exactly what you said. It works in a way that I get an output, I get one value in my mail! Which is great, but now is the next question, how can I get all the values? I have got a whole list of products and values. The select box are not being populated by a MIGXTV, I want these just zero till 10 for every item. What is created by the MIGXTV are the titles (names of my products).

              I was thinking that this would work:
              <select name="mySelectBox[[+MIGX_id]]">
              		<option value="0" selected="">0</option>
              		<option value="1" selected="">1</option>
              		<option value="2" selected="">2</option>
              		<option value="3" selected="">3</option>
              </select>


              With in the email tpl:
              [[+mySelectBox[[+MIGX_id]]]]


              But it doesn't.
              How can I make this work?

              Another question will be, how can I get the list op products (MIGXTV) in the email template?
              I would like to show only the products with a higher value then zero selected.
              The list should for example look like this:
              Product name: 1
              Product name: 4
              Product name: 3

              Hi,

              Appreciate the frustration and honestly the question here is quite off putting just because of the length of this thread so far - its a task to read and process everything that has happened so far. I think you may be best off just summarising everything in one post on what it is exactly that you're trying to do here.

              If you want to display all values in the email why are you trying to put them into a select box? What is it that you want the user to select? If you want to display multiple values or all values then you need to create a prehook to json encode the array eg:

              $hook->setValue('hobbies',json_encode(array('music','films','books')));
                ■ email: [email protected] | ■ website: https://alienbuild.uk

                The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
                • 54524
                • 34 Posts
                LK: I understand, seems like a good idea to start a new post. For some reason is it hard to explain.
                In the form I've a list of products, I want a visitor be able to choose for each product how much they want, 0 to 10.
                It's most functional to show this in selectboxes, so that's why I created that.

                Thanks for the hook!
                But can you please explain for me how it works?
                Do I need to put this in the email tpl?
                Is is correct that 'music, films & books' the options are? So I would put in the numbers there?

                I think now we are getting somewhere.
                Thanks a lot!

                I will wait for your reaction or otherwise start a new post.

                  • 17301
                  • 932 Posts
                  Right ok I think I understand now smiley
                  So you essentially want to do is :

                    > list products that your client has manually entered in the back end
                    > render those products to the front end
                    > have your users select a quantity
                    > then in the email return the quantity related to the product?



                  If so then you don't need the hook I mentioned above thats for handling select boxes where the user can multi-select.

                  Instead what I would do personally is this...it may not work!

                  Set your select boxes up like so:

                  <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>


                  Create a postHook called 'processOrder'

                  $allValues = $_POST;
                  
                  
                  foreach($allValues as $key => $value) {
                  	list($product_, $productTitle) = explode('-', $allValues);
                      if (strpos($key, $product_) === 0) {
                      	$productList .= 'Title:' . $product[$key] . 'Quantity' . $product[$value];
                  
                      }
                  }
                  
                  $output = str_replace('[[+products]]', $productList, $output);
                  
                  return ($output);


                  Call the hook in your formit call before the email hook

                  In your emailTpl set the placeholder [[+products]]

                  [ed. note: lkfranklin last edited this post 5 years, 8 months ago.]
                    ■ email: [email protected] | ■ website: https://alienbuild.uk

                    The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
                    • 54524
                    • 34 Posts
                    Exactly!

                    Just tried, but I get a white screen when I try to submit the form. There must be something wrong.

                    I created the postHook in a snippet, and called it 'processOrder'.
                    Then I created this in the formit call:
                    [[!FormIt?
                    &hooks=`processOrder,spam,email,FormItSaveForm`


                    Do I understand it correctly?
                      • 17301
                      • 932 Posts
                      I missed a ')'. I've updated it.
                      It may not work though its just a stab in the dark, my PHP isn't great.
                        ■ email: [email protected] | ■ website: https://alienbuild.uk

                        The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.