KoolReport's Forum

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

Not able to add default value to field in resources (CRUD) #2441

Open Anjali opened this topic on on Nov 18, 2021 - 4 comments

Anjali commented on Nov 18, 2021

Hello, I am not able to add default value to text field while use create any record and save. Using resources from admin panel to Add record.

KoolReport commented on Nov 18, 2021

You may try to set input widget manually with default value like this:

Text::create("myColumn")
    ->inputWidget(
        TextBox::create()->defaultValue("my default value")
    )

Let us know if it works.

Anjali commented on Nov 18, 2021

I have tried but its not working. I have field 'created_by' which is integer field and it will have user id in it. So just trying to add default value 1 when create form is submitted.

Number::create("created_by") 
->inputWidget(
TextBox::create()->defaultValue('1')
),

Thanks.

KoolReport commented on Nov 18, 2021

I see, no worry. I have reported to dev.team to find solution for you.

KoolReport commented on Nov 19, 2021

Please get the Dashboard 3.2.4 then you do:

Number::create("created_by") 
->inputWidget(
TextBox::create()->defaultValue('1')
),

Please let us know if it works.

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

None