KoolReport's Forum

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

Radio Button Post Value Not Change #1172

Open Jason opened this topic on on Nov 20, 2019 - 6 comments

Jason commented on Nov 20, 2019

When I have a Radio List on a form, and I do a form post after changing the default selection, the value shows it changed in the POST parameter, but when i reference $this->params["radioList"], the value is always the same.

Also is there a way to prevent the query in setup from executing on page load. I want the user to select their options before required to execute sql.

 function setup()
    {
		error_log($this->params["radioList"]);
        $this->src('datasource')
        ->query( "SELECT time_logged time, :trend feeder FROM trending WHERE time_logged BETWEEN :start AND :end ")->params(array(
			":trend"=>$this->params["radioList"],
			":start"=>$this->params["startDatePicker"],
            ":end"=>$this->params["endDatePicker"]
        ))
        ->pipe($this->dataStore("trendingData"));
    }

}
KoolReport commented on Nov 20, 2019

Do you mean you use the \koolreport\inputs\RadioList, dont you? It could be reason that you have not bound the radioList widget to the report's parameters. Please check!

Here is the documentation of binding parameters to inputs.

And here is our example.

Let me know if you need further assistance.

Jason commented on Nov 20, 2019

You are correct.

Also is there a way to prevent the query in setup from executing on page load. I want the user to select their options before required to execute sql.

KoolReport commented on Nov 20, 2019

It is very simple, you can set default values for radioList. So in the first load, radioList will have that default value. In the setup() function, you detect if the $this->params["radioList"] as default value then you dont execute any query or pipe.

At the view of report, the same logic is applied. If you detect the radioList param has default view, you don't show result.

Jason commented on Nov 20, 2019

Thank you, that did help!

Jason commented on Nov 20, 2019

IS there a way i can populate a dropdown based on the previous selections in the form. So they choose this option, and based on that option i want to populate my dropdown from a query with those parameters.

I see how to do it within setup, doing a form post on change, but is there a way without having to do a form post?

KoolReport commented on Nov 21, 2019

May be you can have a look at this example. The example demonstrate how to use SubReport to create dynamic form. Under the hood, it uses ajax to update the form with further select options.

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
None yet

Inputs