We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3096
    • 6 Posts
    I have a form which is used as a profile editor using the UpdateProfile snippet. Users populate this data when they initially register, and the data is confirmed present when their profile is checked through the manager.

    There are dropdown selects which populate fine when using the "FormItIsSelected" placeholder, but the checkboxes do not popuate, and they are using the "FormItIsChecked" placeholder.

    Im not sure if there is something special I need to do because the checkbox data is an array of data in the user's extended profile, but all data populates fine except for the checkboxes. Here is the code for the snippet call in the form chunk:

    [[!UpdateProfile? &submitVar=`registerbtn`
        &postHooks=`addinvestorinterests`
        &validate=`range:required,
      stageofevolution:required,
      investmentform:required,
      returnpreference:required,
      holdingperiod:required,
      sectors:required`
    ]]


    And here are the checkboxes that I am trying to populate:
                <input type="hidden" name="stageofevolution[]" value="" />
                <input type="checkbox" class="checkbox" name="stageofevolution[]" value="Seed/Start-Up" [[!+stageofevolution:FormItIsChecked=`Seed/Start-Up`]] id="stageofevolution1" /><label for="stageofevolution1" class="checkbox">Seed/Start-Up</label>
                <input type="checkbox" class="checkbox" name="stageofevolution[]" value="Emerging/early Stage" [[!+stageofevolution:FormItIsChecked=`Emerging/early Stage`]] id="stageofevolution2" /><label for="stageofevolution2" class="checkbox">Emerging/early Stage</label>
                <input type="checkbox" class="checkbox" name="stageofevolution[]" value="Expansion Stage" [[!+stageofevolution:FormItIsChecked=`Expansion Stage`]] id="stageofevolution3" /><label for="stageofevolution3" class="checkbox">Expansion Stage</label>
                <input type="checkbox" class="checkbox" name="stageofevolution[]" value="Late Stage" [[!+stageofevolution:FormItIsChecked=`Late Stage`]] id="stageofevolution4" /><label for="stageofevolution4" class="checkbox">Late Stage</label>
              <span class="error">[[+error.stageofevolution]]</span>


    Any help I can get on this would be much appreciated [ed. note: benitosy last edited this post 14 years, 1 month ago.]
      • 3096
      • 6 Posts
      Self solved. Guess no one cares about this problem.

      snippet.formitischecked.php looks for the input as an string and explodes by "," but it always shows empty when dumped to screen. From this Im assuming that arrays are not being passed in successfully.

      added this code to line 156 in controllers/web/UpdateProfile.php to convert arrays to string imploded by ",".

              foreach($placeholders as $index => $placeholder){
                  if(is_array($placeholder)) $placeholders[$index] = implode(',',$placeholder);
              }
        • 10378
        • 375 Posts
        Hi,

        thanks alot for the workaround! I had the same problem.
        I also filed a bug at the modx bugtracker (borrowed most of your text and code - hope this is no problem for you).

        Greetings,
        Martin
          Freelancer @bitego http://www.bitego.com
          ---
          GoodNews - one of the most advanced and integrated Group Mailer premium add-ons for MODX Revolution!
          More infos here: http://www.bitego.com/extras/goodnews/
          • 23018
          • 353 Posts
          @gadgetto
          Thanks for filing this one at bugtracker. I stumbled upon this problem 5 minutes ago. Fired up modx bugtracker and found a solution to this problem within seconds.

          http://tracker.modx.com/issues/8795

          How awesome is that?

          Thanks!

          P.S. Can somebody shed a light on the question if we should post such problems on bugtracker or on github?

          @benitosy
          Thank you for tracking this particular problem down.

          I'm sure people care about problems like this but the whole web user stuff is something that most people here never even touch in day to day business, so something like this can be easily missed.



            Homepage: pepebe.de | MODX snippets (and other stuff) at github: https://gist.github.com/pepebe