We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16633
    • 116 Posts
    Quote from: BobRay at Oct 23, 2010, 09:05 PM

    Quote from: landonpoburan at Oct 23, 2010, 07:03 PM

    Quote from: BobRay at Oct 23, 2010, 06:48 PM

    Sorry, I didn’t notice this at first. You can’t use MODx tags in a snippet. You’d want something like:


    $emerald = $emerald_hereabout


    Ok but how do I get the value of [[*emerald_hearabout]] in that variable?

    If it’s the name of an input field and the form’s method is "post" it should be in $_POST[’emerald_hearabout’].

    Sorry I may not be explaining myself properly.
    The form is being submitted and stored as a resource. Now I am displaying this resource on the front end. But the 1 field is multiple checkboxes so it is an array. This array is stored in the [[*emerald_hearabout]] TV. So when I simply output [[*emerald_hearabout]] it displays "Array". Does that help with what I am trying to do?
      --
      Landon Poburan
      Web Designer and Developer

      http://www.categorycode.ca
      http://www.landonp.com
      • 3749
      • 24,544 Posts
      I’m still not sure I get what you’re doing, but I’m probably just tired.

      It sounds like the resource is created dynamically, and you are creating the TV and/or filling it’s value in code. What code creates the TV? What does the TV look like when you edit the resource? What does the TV value look like in the DB?

      If I’m understanding you, the solution is to send the TV to a snippet for conversion:

      [[!ConvertTv? &tvValue=`[[*emerald_hearabout]]`]]


      In your ConvertTv snippet, put this to start so you’ll know what you’re dealing with:

      return print_r($tvValue,true);


      Then put code in the snippet that converts that variable to HTML code of the output you want.

      I hope I’m on the right track with what you’re trying to do. tongue



        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 4172
        • 5,888 Posts
        Added this to formit2resource to store values of checkboxes correct:

                /* handles checkboxes & multiple selects elements */
                if (is_array($value)) {
                    $featureInsert = array();
                    while (list($featureValue, $featureItem) = each($value)) {
                        $featureInsert[count($featureInsert)] = $featureItem;
                    }
                    $value = implode('||',$featureInsert);
                }	


        I hope this helps.
        See the link in my Signature
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 16633
          • 116 Posts
          Quote from: Bruno17 at Oct 24, 2010, 01:40 AM

          Added this to formit2resource to store values of checkboxes correct:

                  /* handles checkboxes & multiple selects elements */
                  if (is_array($value)) {
                      $featureInsert = array();
                      while (list($featureValue, $featureItem) = each($value)) {
                          $featureInsert[count($featureInsert)] = $featureItem;
                      }
                      $value = implode('||',$featureInsert);
                  }	


          I hope this helps.
          See the link in my Signature

          Thanks that works for it but I seem to be having some other issues. Please see: http://emeraldfoundation.dreamhosters.com/judges-portal This page is displaying the entered resources.

          The ones I am submitting then viewing on this page now, don’t have a proper website address. Even when I click preview on the resource in the manager it doesn’t go anywhere. Seems really odd. The ones from before worked.

          Also another thing, When I submit it, it doesn’t submit, BUT there are no errors then submit again and it works.

          Also <p>[[+fi.error.error_message]]</p>, that does not show anything ever? If there are errors shouldn’t this say something like "We Encountered an Error" or something?
            --
            Landon Poburan
            Web Designer and Developer

            http://www.categorycode.ca
            http://www.landonp.com
            • 4172
            • 5,888 Posts
            what is, when you try it without custom-hooks?
            Did you read the formit-docu and tried that example?
            You can start with the formit-example.
            Then change the form in small steps and add the hooks to see where the issues come from.
            Then perhaps you have to debug formit2resource to see what goes wrong.
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
              • 16633
              • 116 Posts
              Quote from: Bruno17 at Oct 25, 2010, 12:21 AM

              what is, when you try it without custom-hooks?
              Did you read the formit-docu and tried that example?
              You can start with the formit-example.
              Then change the form in small steps and add the hooks to see where the issues come from.
              Then perhaps you have to debug formit2resource to see what goes wrong.

              In formit2resource, how can I set the "resource-alias" to be the id of the page? I know this will fix 1 of my issues.
              Also, <p>[[+fi.error.error_message]]</p> has never worked, not even in the formit example.
                --
                Landon Poburan
                Web Designer and Developer

                http://www.categorycode.ca
                http://www.landonp.com
                • 4172
                • 5,888 Posts
                you can try to add alias-handling from /core/model/modx/processors/resource/update.php
                  -------------------------------

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!
                  • 16633
                  • 116 Posts
                  Quote from: Bruno17 at Oct 25, 2010, 12:55 PM

                  you can try to add alias-handling from /core/model/modx/processors/resource/update.php

                  Is there a way to do it like you set the other values?

                  $doc->set(’template’, ’2’);
                  $doc->set(’published’,’1’);
                  $doc->save();

                  something like

                  $doc->set(’resource-alias’, $id);
                    --
                    Landon Poburan
                    Web Designer and Developer

                    http://www.categorycode.ca
                    http://www.landonp.com
                    • 4172
                    • 5,888 Posts
                    if you mean with resource-alias the field alias try:

                    $doc->set('alias', $id);
                      -------------------------------

                      you can buy me a beer, if you like MIGX

                      http://webcmsolutions.de/migx.html

                      Thanks!
                      • 16633
                      • 116 Posts
                      Quote from: Bruno17 at Oct 25, 2010, 02:17 PM

                      if you mean with resource-alias the field alias try:

                      $doc->set('alias', $id);


                      Sorry just to clarify, does "$id" actually hold the id of the resource being created?
                        --
                        Landon Poburan
                        Web Designer and Developer

                        http://www.categorycode.ca
                        http://www.landonp.com