Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi @hamlet237,

    I’m sorry you’re having this issue!

    Would you mind sharing the code you’re modified for custom registration so we can take a look at why could be causing this issue?

    You can share code with this method:

    We’re happy to take a look and get this solved for you!

    Let us know if you have any additional questions!

    Thanks and take care,

    Thread Starter hamlet237


    Thank you Natalie. This is the code:

    I´m working in a class function so please note the hooks with array(&$this,… added.

    The problem happens with $user_diseases array which loads a multiple select tag.

    Thanks in advance!

    Hi @hamlet237,

    I apologize for the delay in response.

    Also, I believe I might have misunderstood your question initially.

    Just to clarify you’re wanting to allow the user the ability to select more than one option from the dropdown menu? If this is the case, this code won’t do that. Creating a multiple select is a big more involved. You would want to use something like this:

         ?><form action="c3.php" method="post">
      <select name="ary[]" multiple="multiple">
        <option value="Option 1" >Option 1</option>
        <option value="Option 2">Option 2</option>
        <option value="Option 3">Option 3</option>
        <option value="Option 4">Option 4</option>
        <option value="Option 5">Option 5</option>
      <input type="submit">
    $values = $_POST['ary'];
    foreach ($values as $a){
        echo $a;

    (This is just an example, you’d have to format it!)

    With this type of PHP select multiple you would have to have the user hold down control/command to select more than one.

    The select box you’re working with here just allows you to provide multiple options, where the user can pick one.

    The easiest method might just be to have this be text input box.

    I apologize for the confusion here!

    Please let us know if you have further questions!

    Thanks and take care,

    Thread Starter hamlet237


    Hi Natalie.
    As you can see in the code I´ve paste for you between lines 191 and 203:

    $user_diseases = array(
            'columns' => 4,
            'id' => 'osaki_user_diseases',
            'classes' => 'osaki-input osaki-select has-multiple',
            'label' => __('Diseases', 'almazen'),
            'last_column' => false,
            'required' => false,
            'options' => $user_diseases_options,
            'type' => 'select',
            'multiple' => true,
            'default' => '',
          array_push($fields, $user_diseases);

    This is a code in PHP that render a multiple select using your lifterlms_get_person_fields filter. Please re-check the code.

    Theese lines creates something like this:

    <select class="llms-field-select osaki-input osaki-select has-multiple" id="osaki_user_diseases" name="osaki_user_diseases" style="display: none;" multiple="multiple"><option value="dont_specify">No quiero especificar mis enfermedades</option><option value="arthritis">Artritis</option><option value="chronic_patient_caregiver">Cuidador de paciente crónico</option><option value="aids">VIH/SIDA</option><option value="type_1_diabetes">Diabetes tipo 1</option><option value="type_2_diabetes">Diabetes tipo 2</option><option value="cancer_survivor">Superviviente de cáncer</option><option value="chron_disease">Enfermedad de Crohn</option><option value="ulcerous_colitis">Colitis Ulcerosa</option></select>

    The select works nice when selecting multiple options but when the date is sent via POST it saves only one option in database. I believe there is a problem with your management of POST data created by a multiple select. Instead of saving an array of values your proccess saves only one string value.

    Thanks in advance Natalie.



    Hi @hamlet237,

    The default LifterLMS fields API doesn’t support multi select as of now. That multiple=true parameter will not do anything and you would end up with a single select only. See: Nowhere is a multiple select used in fields here

    So,I’m not sure how you have a multiple select working with the code that you’ve shared.

    You’d have to go a step further and filter the form field markup to make this happen, as of now. However, if you could make changes to support the multiple parameter and send in a PR to our Github repo, we’d be more than happy to accept it!

    If the multiple select would work, there’s nothing in the code that would do what you’ve suggested. For example, the registration form straightaway dumps the post data without stripping anything anywhere:

    Could you please check and confirm everything again?


    Thread Starter hamlet237


    Hi @saurabhshukla .
    Yesterday I made a fork and two commits about the topic. Try the code and confirm that it works. For me it is working now.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Select multiple in Lifterlms Registration form’ is closed to new replies.