This topic is locked

Import - Column headers in line - Checkbox

11/10/2023 10:05:17 AM
PHPRunner General questions
dageci authorDevClub member

Hello,
Is there an event for the Import page in that I could make the Checkbox "Column headers in line #" alway be checked.

My users update the data frequently, and sometimes forget to check it and then they import the column headers.

This is what I mean:

img alt

Thank you for any suggestions,
Davor

admin 11/10/2023

I guess you can implement BeforeInsert event, check for data validity there and skip the rows that do not pass the validation.

C
charlesfolder 11/26/2023

Put This in Javascript OnLoad Event
$("#headersLineOption1").prop('checked', true);
$("#headersLineOption1").prop('disabled', true);

dageci authorDevClub member 11/27/2023

Thanks @charlesfolder for your reply.

Don't know why, but it disables the checkbox, but it doesn't check it.

Dalkeith 11/29/2023

Sounds like charlesfolder's code is firing both instructions at the same time and for whatever reasons disabled completes first.
I've noticed that with javascript code before - it doesn't seem to run consecutively.

I would comment out the disabled option firstly to see if the checked code line works and then I would try delaying the disabling instruction with something like.. setTimeout
adjust millieseconds parameter to get as smooth as possible.

Put This in Javascript OnLoad Event
$("#headersLineOption1").prop('checked', true);
setTimeout("$("#headersLineOption1").prop('disabled', true);", 2000);

Make sure you hit the syntax check button my code is air code and I suspect their might be issues with quotations within quotiations.

I asked chatgpt to improve my air code it came up with this.

$("#headersLineOption1").prop('checked', true);
setTimeout(function() {$("#headersLineOption1").prop('disabled', true);}, 2000);

dageci authorDevClub member 11/29/2023

There is no need for disabling the checkbox.

When I put in on load javascript event on the import page only:

$("#headersLineOption1").prop('checked', true);

Nothing happens