Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

Restricting user not to modify the content in the rich textbox

Avatar

Level 3

Hi All,

How can we restrict the user not to modify the content of a rich textbox i.e not to change color of some text or not to change the font size etc.

Here goes the explanation of the senario

step1: Drag and drop the textbox and check the allow multiple lines checkbox and increase the size of the textbox as shown. Change the field format to rich text.

textbox.JPG

step2: Copy some text with different font style from a word document.

textval.JPG

step3: When you paste the text in the textbox on the preview pdf window the text retains its font style from the

Word document.

preview.JPG

step4: If you click control+E,you will get a tool bar where you can change the text color,font-size etc..

toolbar.JPG

How can we restrict the user not to edit some of the text in the rich textbox.Like not to give the user full control for the styling of the text display.....

????

Thanks

5 Replies

Avatar

Level 10

The only way you can restrict the user not to modify the content is by changing the type in Value tab to either Protected/ ReadOnly.

You can do this at the runtime by setting the access property of the field.

this.access = "readOnly";

Thanks

Srini

Avatar

Level 3

Like how can I set this @ the run time....

Before going to the preview pdf window the condition should be verified ??? or when the user starts entering in the textbox ????

Avatar

Level 10

It depends on the scenario you are currently at.

If the data in the rich text field is populated thru XML then you can restrict the field at the design time itself (or) use Initialize event.

If you want to restrict the user after placing the value, then you can use the Exit event.

Hope this gives an idea..

Thanks

Srini

Avatar

Level 3

Thanks for your response,but I want to disable some of the options on the toolbar which comes onclick of control+E.How can I do this using scripting??

Avatar

Former Community Member

I am not aware of any way to restrict aspects of the Rich Text Field. It is either on (you get all of the options) or you get none.

Paul