Expand my Community achievements bar.

SOLVED

server validation for removing html tag from text field component

Avatar

Level 4

I am using http://localhost:4503/libs/foundation/components/form/text/text.jsp which has sling:resourceSuperType    pointing to     foundation/components/form/defaults/field

I need to chage the validation that would throw any error from server validation if any html tag is feed say <script> </script> on the text field
please let me know how to acheive it 

currently i see 2 parameter added in the form field

required             Boolean    true    
requiredMessage         String        Please enter name


server validation for removing html tag from text field component

 

Thanks,

1 Accepted Solution

Avatar

Correct answer by
Level 10

This is the path for /libs/foundation/components/form/defaults/field/servervalidation.jsp for jsp file

Override this in your project and implement your logic.

More ever I would suggest you to add some listener so that your clientside validation will also be strong.

View solution in original post

3 Replies

Avatar

Level 10

To do this - you need to overlay the text and form field and then modify the servervalidation.jsp. Never modify content under /libs. 

Avatar

Level 4

To overlay I  didnot find the servervalidation.jsp under /libs/foundation/components/form/text/text.jsp.

Please let me know   how to proceed

Avatar

Correct answer by
Level 10

This is the path for /libs/foundation/components/form/defaults/field/servervalidation.jsp for jsp file

Override this in your project and implement your logic.

More ever I would suggest you to add some listener so that your clientside validation will also be strong.