In HTML entities->editor input, I have this code for the jQuery change event:
Code: Select all
if ($(this).prop('checked')==false) {
return;
}
var result = confirm("Are you sure you want to delete this user account ?");
$(this).prop('checked',result);
if (result==false) {
$(this).prop('checked',result);
return result;
}
If it isn't checked and you are checking it, the confirm() dialog is shown.
It used to be where you didn't need to manually check or uncheck the checkbox.
By returning false in HTML entities, the checkbox would remain unchecked if you had checked it but clicked on cancel in confirm() which results in return false;
This doesn't appear to be the case any more so I've resorted to manually unchecking it
While stepping through this code in the Chrome Developer console, if I put a breakpoint on the line return result; after clicking on cancel in the confirm() dialog, the checkbox does get unchecked correctly.
It seems that returning false doesn't stop execution of the script because after the return statement, it appears as though there's jQuery related code that is being executed. After that jQuery code has finished executing, the checkbox is checked again.
Is this a bug with HTML entities ? I have 2 different instances of eBase 5.2.1 that have this same issue
There is no server side event tied to this field that would modify its checked state.
Update: I found out what the problem was but it doesn't make any sense to me why its causing a problem. Immediate Validation was checked but as I mentioned before, there was no server side script being executed but regardless, the fact that Immediate Validation was checked was causing this behavior. After unchecking it, the problem went away.
This is still an issue though where if you want to use HTML entities, you cannot use immediate validation with a server side script because it will execute the server side script immediately and bypasses the HTML entities events entirely. I realize that you can use executeFunction() to run a server side function but this is not a good approach in my opinion.
I hope that this will be fixed in the next version of eBase so that even if immediate validation is checked for a control, the HTML entity events gets executed first, if there are any.