KoolReport's Forum

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

Selection Box example with value and text? #1973

Open Steven opened this topic on on Mar 15, 2021 - 2 comments

Steven commented on Mar 15, 2021

I would like a report to work based on a selection from a list. This list should be filled from database. In your selection example it only shows with the country. I would like the user the see the country name, but the country code to be used as a parameter on the report. I know how to do it in HTML. Not sure how in KoolReports. Can anyone help?

in Html it would look like this:

<option value="124">Canada</option>
<option selected value="316">United States</option>
<option value="044">Bahamas</option>

Thanks!

Sebastian Morales commented on Mar 16, 2021

Steven, you could the the Inputs package's Select, Select2 or BSelect controls. Just specify their "dataSource" and "dataBind" like this:

    Select2::create(array(
        "dataSource" => ..., //$this->dataStore("myds") or [ "displayText" => "zero", "realValue" => 0, "displayText" => "one", "realValue" => 1, ...]
        "dataBind" => array(
            "text" => "displayText",
            "value" => "realValue"
        ]

Hope this helps. Rgds,

Steven commented on Mar 16, 2021

Thank you!

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
solved

None