File tag change event: Uncheck checkbox when file is changed

This public forum is for user-to-user discussions of ASP.NET Maker. Note that this is not support forum.
Post Reply
JerryACSA
User
Posts: 15

File tag change event: Uncheck checkbox when file is changed

Post 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?


MichaelG
User
Posts: 1095

Post by MichaelG »

You can also check for the drag and drop events. Read:
https://developer.mozilla.org/en-US/doc ... drag_event


JerryACSA
User
Posts: 15

Post 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);
	}
}

Post Reply