This is the work around I found:
$(window).on("load", function () {
$(".ValidationRequired").on("focusout", function () {
validate($(this));
})
})
function validate($this) {
var $workingForm = _utilsSvc.getWorkingFormFromInnerElement($this);
var workingFormGuid = _utilsSvc.getFormIdentifier($workingForm);
var workingFormInfo = epi.EPiServer.Forms[workingFormGuid];
workingFormInfo.$workingForm = $workingForm;
return validateElement($this, workingFormInfo);
}
WHERE validateElement is as defined in EPiServerForms.js
This works, but it is a major hack. EPiServer should make more of the functions easier to trigger from the outside or make something that works. I see EPiServer has had some code for blur, change, keyup earlier; but they have commented it out. They should at least make it possible to activate this without removing the comments and then you would be back at square one next time you update.
Hi all,
From the beginning, Forms JavaScript in ViewMode is not ready to be customized. Its JavaScript just works, to fulfill designed features.
We have another constraint that with or without JavaScript, Forms should behave (kind of) the same for each feature. This requirement might be lifted, and I think Forms will go to the direction of "with JS, you have better exprience. Without JS, you only have basic feature".
Then we slowly rollout some functions to the public. For current version (Forms 4.3)
- what is in epi.EPiServer.Forms (let say F object) is usable.
- F.Data contains functions about get/load/save/clear temporary data in browser
- Functions in F.Extensions can be replaced with your customized one. (you can see Samples project changed F.Extensions.showSummarizedText() to change the way how Forms show the summaryText before submitting.
- F.Utils contains functions that you can "re-use"/trigger outside of Forms closure. Yes it is not good as an perfect public API.
We will try to bring more private functions into F.Utils, but I cannot guaranty it has highest priority at the moment. I am sorry about the limitation and workaround you have to do this time.
Does anyone know if it's possible to trigger validation for a field on blur?
With jQuery validate the error message is removed when the user enters the correct input.
I want the user to get a response right away that his input is correct and not have to click the next/submit button.