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

Avatar

Avatar
Validate 1
Level 2
AEM_Coder
Level 2

Likes

3 likes

Total Posts

13 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Give Back 3
Give Back
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 2
AEM_Coder
Level 2

Likes

3 likes

Total Posts

13 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Give Back 3
Give Back
Boost 3
Boost 1
View profile
AEM_Coder
Level 2

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
Springboard
Level 10
Mayank_Gandhi
Level 10

Likes

327 likes

Total Posts

1,153 posts

Correct reply

185 solutions
Top badges earned
Springboard
Establish
Validate 1
Contributor 2
Ignite 5
View profile

Avatar
Springboard
Level 10
Mayank_Gandhi
Level 10

Likes

327 likes

Total Posts

1,153 posts

Correct reply

185 solutions
Top badges earned
Springboard
Establish
Validate 1
Contributor 2
Ignite 5
View profile
Mayank_Gandhi
Level 10

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)