cancel
Showing results for 
Search instead for 
Did you mean: 

Editor area readonly java

cristian_sp
Explorer

Hi,

is there a way to mark an attribute from an editor area as readonly from java, depending on model attribute condition?

I have this code

where the attribute 'discountString' can be modified.

What I want to do is to mark it as readonly depending on conditions from DiscountRow model.

Thanx

Accepted Solutions (1)

Accepted Solutions (1)

mansurarisoy
Contributor

You can achieve this with Dynamic Forms. With disabledIf option, I believe you can achieve what you need.

cristian_sp
Explorer
0 Kudos

Hi Mansur. Thanks for your reply. I'll try this solution 😉

cristian_sp
Explorer
0 Kudos

In one context I can't have an editor area and an editorAreaDynamicForm.

I have to change all context and attributes so I can use this dynamic attribute.

For those cases when the context has many attributes I think that changing the readonly attribute from java is a better way than changing all attributes from context in order to allow dynamic attributes.

I'll keep searching to see if these can be done and, if it is impossible, I'll use your solution 😉

mansurarisoy
Contributor

Why do you need to put the editor and editorAreaDynamicForm in the same context? You should specify dynamicForm as additional context for types, not in the same context with editor context. For example, in your case, adding the following context in backoffice config file should work. Editor context should stay the same, no change is needed for the editor context. (In condition there should be no space between & and gt and ; )

<context type="DiscountRow" component="editorAreaDynamicForms" merge-by="module">
	<df:dynamicForms xmlns:df="http://www.hybris.com/cockpitng/component/dynamicForms">
		<df:attribute id="dfDiscountString" triggeredOn="*" qualifier="discountString" disabledIf="(value & gt ; 50)" />
	</df:dynamicForms>
</context><br>
cristian_sp
Explorer
0 Kudos

thanx a lot Mansur. It works 😉

Answers (0)