KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Custom select2 values aren't passed to Form from dataStore #2089

Closed Keith opened this topic on on May 17, 2021 - 1 comments

Keith commented on May 17, 2021

I have a form using 1 custom select2 I'm trying to implement from here: https://github.com/wasikuss/select2-multi-checkboxes

I'm populating the option values with an array in my datastore. The Select shows fine and the correct options are shown. But when I press Generate report values aren't passed.

      <form method="post" id="filterform">
          <div class="row">
              <div class="col-md-4">
                  <div class="form-group">
                      <b>Filter Location </b>

                        <select name="sel-02" id="sel-02" class="form-control select2-multiple2" form="filterform" multiple>
                            <?php
                                $locations = $this->dataStore("location_names")->pluck("name");
                                foreach($locations as $item){
                                    echo "<option value='strtolower($item)'>$item</option>";
                                }
                            ?>
                        </select>
                  </div>
                  
                  <button onclick="clear_filter()">Reset all</button>
                    <script type="text/javascript">
                        function clear_filter()
                        {
                            $('#loc_name').val(null).trigger("change");
                            $('#prog_name').val(null).trigger("change");
                            $('#current_status').val(null).trigger("change");

                        }
                    </script>
                  <div class="form-group" style="margin-top:10px;">
                      <button class="btn btn-lg btn-primary">Generate Report</button>
                  </div>
              </div>

           </div>

      </form>

Is there an issue with how I'm setting up my form?

Keith commented on May 17, 2021

Solved. Didn't specify select name.

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed

Inputs