KoolReport's Forum

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

DefaultParamValues is not being called. why? #1559

Open Richb201 opened this topic on on Aug 12, 2020 - 4 comments

Richb201 commented on Aug 12, 2020

protected function defaultParamValues()

{
    return array(
        "dateRange"=>array('201707')
    );
}

I put a breakpoint on defaultParamValues() but that never seems to get called.

I have DateTimePicker

<form method="post">
    <?php \koolreport\inputs\DateTimePicker::create(array("name" => "dateRange","format"=>"YYYYMM","useCurrent" =>false)); ?>
    <button type="submit">Submit</button>
</form>

After the user presses Submit, I would like to be able to set the default date to whatever the user has set it to. I can get it via _POST fine. But I don't know where (how?) to set it. The date always defaults to current date. Please help!

David Winterburn commented on Aug 13, 2020

Hi Richard,

Did you add these traits to your report class?

    use \koolreport\inputs\Bindable;
    use \koolreport\inputs\POSTBinding;
Richb201 commented on Aug 13, 2020

David, I am not sure what you mean by "in the class"? They are at the top of the MyReport.php. They do NOT appear in MyReportView.php. I am assuming that defaultParamValues must be run each time?

Richb201 commented on Aug 13, 2020

I traced through with my debugger I found that DateTimePicker was not being found. Here is as found on my hardrive. /opt/docker-substantiator2/app/vendor/koolreport/inputs/DateTimePicker.php

After seeing this I modified the path as follows in myReport.view.php to be:

"dateRange","format"=>"YYYYMM","useCurrent" =>false)); ?>

I am using Ubuntu, not Windows, thus the / instead of . I am getting a bunch of errors from this line. Including: A non-numeric value encountered Division by zero Use of undefined constant inputs - assumed 'inputs' (this will throw an Error in a future version of PHP) A non-numeric value encountered

So there is something seriously wrong here. The code I am using is the code that you suggested i use:

"dateRange","format"=>"YYYYMM","useCurrent" =>false)); ?>

Please support my use of this inputs package.

David Winterburn commented on Aug 14, 2020

Please post your full report's setup and view for us to check it for you. Post the code using this code button:

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

None