We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17016
    • 138 Posts
    Regarding "Custom Fields" we were going to use checkboxes like this:

    <input type="checkbox" name="color" value="[[+color]]" />blue
    <input type="checkbox" name="color" value="[[+color]]" />red
    

    Of course this doesn´t work. But what do we have to change to make it work?

    Our goal is to use the placeholder later on like this:

    [[!If? &subject=`[[+color]]` &operator=`inarray` &operand=`blue` &then=`One of your favorite colors is blue`]]


    In the rtfm we only found an example for type="text":
    http://rtfm.modx.com/display/ADDON/Login.Using+Custom+Fields
      • 17016
      • 138 Posts
      A similar question regarding the gender: What did we wrong in these lines:

              <label for="gender">m/f <span class="error">[[+error.gender]]</span> 
              </label> <br />
              <input id="gender" name="gender" type="radio" value="0" /> female<br />
              <input id="gender" name="gender" type="radio" value="1" /> male


      Unfortunately these lines don´t transfer the gender out of the input-form to the user-attributes. Is there a better way to ask for gender in the registration process of the Login-tool?
        • 22019
        • 390 Posts
        I think female is 2 in the database, and no answer is 0. I’ve definitely got that value working from a Login form.

        Not entirely sure I follow what you want to do with your first post.
          Writer > E-consultant > MODx developer || Salesforce || modx 2.x || PHP 5.2.13 || MySQL client 5.0.86
          • 17016
          • 138 Posts
          Thank you very much. You are right: 1 and 2 are the correct values. We took 0 and 1 like it was written here:

          http://bobsguides.com/revolution-objects.html

          Thanks again.

          Regarding the first post:
          We want offer a short list of words/attributes of which one ore more can be chosen in the register-form.

          These words/attributes should be saved in a placeholder of a user´s profile for further use.

          Do you know if this is possible?
            • 22019
            • 390 Posts
            The placeholder is only used for output.

            When you create the form with a field that isn’t in the user table by default, Revo stores the value as a name-value pair in a JSON-encoded variable called ’extended fields’. If you just let Register snippet work normally, it will create that field WITHIN extended_fields (so it’s not immediately available on output - you need to deserialise it).

            On the user interface (Manage Users > Select a user > Update user) it’s the fourth tab along = ’Extended fields’
              Writer > E-consultant > MODx developer || Salesforce || modx 2.x || PHP 5.2.13 || MySQL client 5.0.86
              • 17016
              • 138 Posts
              Hi odeclas,
              we want to ask in the registration-process:

              What are your favorite colors?
              For the answer we want to offer these colors: red, blue, white, green and yellow.

              A user should be able to choose more than one color resulting for example in a list like this: "green,blue,red" which should be stored in the placeholder [[+color]]

              I am not sure if this is possible. Does anybody knows this?
                • 22019
                • 390 Posts
                Terminology is important - you don’t store variables in a placeholder. I think you mean you want a single field to store the answer, regardless of how many colors are selected? ie colors=’Red’ or colors=’Red, Blue, Green’.

                You might want to look at the FormIt checkbox handling tutorial for some ideas:
                http://rtfm.modx.com/display/ADDON/FormIt.Handling+Selects%2C+Checkboxes+and+Radios

                Login and FormIt handle validation differently, but they both handle things in a similar way. If the output is not how you like it from the form, you can use a &hook (&posthook I think it is in Login) that could cocatenate the variables together into a single answer. If you use a hook, all the variables are available via $hook->get(’foo’); which gets round your earlier issue.
                  Writer > E-consultant > MODx developer || Salesforce || modx 2.x || PHP 5.2.13 || MySQL client 5.0.86