Skip to content

Commit e1096a7

Browse files
committed
fix issue with regex form tooltip
1 parent 4b54ac9 commit e1096a7

File tree

1 file changed

+5
-4
lines changed
  • webapp/src/main/webapp/WEB-INF/jsp/fragment

1 file changed

+5
-4
lines changed

webapp/src/main/webapp/WEB-INF/jsp/fragment/form.jsp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,11 @@
201201
<script type="text/javascript">
202202
PWM_GLOBAL['startupFunctions'].push(function(){
203203
PWM_MAIN.addEventHandler('<%=loopConfiguration.getName()%>', 'input', function (event) {
204-
event.target.setCustomValidity("");
205-
});
206-
PWM_MAIN.addEventHandler('<%=loopConfiguration.getName()%>', 'invalid', function (event) {
207-
event.target.setCustomValidity('<%=StringUtil.escapeJS(loopConfiguration.getRegexError(formLocale))%>');
204+
var input = event.target;
205+
var regexError = '<%=StringUtil.escapeJS(loopConfiguration.getRegexError(formLocale))%>';
206+
var msg = input.value.search(new RegExp(input.getAttribute('pattern'))) >= 0 ? '' : regexError;
207+
input.setCustomValidity(msg);
208+
input.title = msg;
208209
});
209210
});
210211
</script>

0 commit comments

Comments
 (0)