AEM Forms DOB or SSN auto append / or - when user enters the value in the form fields

Avatar

Avatar

AEM_Coder

Avatar

AEM_Coder

AEM_Coder

25-02-2019

Hi Team,

How to append / or - when user enters the value in aem form fields. For DOB it should append / like 12/12/1990 and for SSN it should append - like 122-321-1234. Patterns option is validating once the focus is out from the form fields whether the value is with that particular format or not.

Is it possible to add / or - while entering the form field value using guideBridge API. If so can you please share some insights or examples. Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

Mayank_Gandhi

Employee

Avatar

Mayank_Gandhi

Employee

Mayank_Gandhi
Employee

04-03-2019

You might have to intercept the field on key press event and add the pattern as required after checking the input length.

Ex:

$('#guideContainer-rootPanel-basics-basics1-guidetextbox_15663786___widget').keypress(function(){

// Your code

alert(textbox_156637861551694584667.value);

});

Replace guideContainer-rootPanel-basics-basics1-guidetextbox_15663786___widget with your element ID, you can obtain it from browser debugger. This need to be placed in code editor on initialize event.

Ref: https://api.jquery.com/keypress/

javascript events - jQuery get input value after keypress - Stack Overflow

Answers (0)