Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

EPiServer forms trigger validation on blur

Vote:
 

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.

#172668
Dec 07, 2016 18:46
Vote:
 

Any update on this? I'm struggling to trigger validation on change

#174433
Jan 26, 2017 10:47
Vote:
 

+1

#174481
Jan 27, 2017 10:44
Vote:
 

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

#174548
Edited, Jan 30, 2017 9:54
Vote:
 

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.

#174556
Jan 30, 2017 13:37
Vote:
 

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.

#174826
Edited, Feb 06, 2017 11:51
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.