I am working on an requirement to show asterisk next to mandatory fields in the form. Since there are many fields in the form I decided to create new component which will append asterisk at the end when author enters title through the component dialog. Below are the changes made for showing asterisk next to text box.
1)Copied both "guidetextbox" and "guidefield" to my project folder in apps
2)Updated "sling:resoursetype" for guidetextbox to "guidefield" in project folder.
3)Updated Label.jsp script in guidefield component with span tag to display asterisk
style="${guide:encodeForHtmlAttr(guideField.captionInlineStyles,xssAPI)}"><label for="${guideid}_widget" id="${guideid}_label">${guide:encodeForHtml(guideField.title,xssAPI)}<span style="color:red"> *</span></label></div>
I am seeing these changes are reflected when authoring the form with custom text box component , However when the form is opened in preview mode text field was not showing any asterisk. Please suggest if there is any alternate way to achieve this .