Page 1 of 1
File tag change event: Uncheck checkbox when file is changed
Posted: Tue Jun 07, 2022 7:23 am
by JerryACSA
I have the following in Client side events in my field using File edit tag:
{ // keys = event types, values = handler functions
"change": function(e) {
$(this).fields("RescanNeeded").prop("checked",false);
}
}
When I click on the field and select a file, it unchecks the checkbox called RescanNeeded. If I drag a new file to the control instead of clicking it, the new file uploads but the checkbox doesn't change so it seems like the change handler isn't running. I guess I could turn off "Use drop zone for file upload fields" in Advanced Settings so the user can't drag and drop. Is there a way to make it work with the new control regardless of which way the file is changed?
Re: File tag change event: Uncheck checkbox when file is changed
Posted: Tue Jun 07, 2022 7:53 am
by MichaelG
You can also check for the drag and drop events. Read:
https://developer.mozilla.org/en-US/doc ... drag_event
Re: File tag change event: Uncheck checkbox when file is changed
Posted: Wed Jun 29, 2022 9:14 pm
by JerryACSA
Thank you! Adding drop
to the event types in Client Side Events makes it uncheck the box when changing the file by either clicking or drag-drop like I want it to. Here is the revised example for anyone else trying to do this:
{ // keys = event types, values = handler functions
"change drop": function(e) {
$(this).fields("RescanNeeded").prop("checked",false);
}
}