Expand my Community achievements bar.

SOLVED

Make a certain input fields read only, based on drop down values

Avatar

Level 1

I have an input form, where I have a drop down field. If the value of this drop down is Archive, I want to make the form read only upon saving the form.

Also, if the value is Active, then I want to make a few fields on the input form read only. For example, if the Status is Archive, then make the Message Code field Read Only. 

MadhukarMa1_0-1729181635638.png

 

 

 

1 Accepted Solution

Avatar

Correct answer by
Level 7

Hi @MadhukarMa1,

 

You can manage your request by using JS to control de behaviour of the input form based on the value selected in the drop down-field.

An approach that you can follow is inside your script inserting a custom disableAllFields() function, that acts like a 'lock' button. It passes through all  the fields in the form and turns them read-only when the  selected value in the dropdown is 'Archive'. So, once 'Archive' is chosen, no one should not be able to make changes to the form.

 

On the other hand, for the "Active " Status, you can use the setAttribute method to disable specific fields, like locking certain parts of the form while leaving others editable.

 

Lastly, I share with you useful documentation links, that can help you:

Set attribute method 

Document: forms property 

FormElement 

JavaScript scripts and templates 

 

¡Hope it helps you!

 

Regards,

Celia

 

View solution in original post

1 Reply

Avatar

Correct answer by
Level 7

Hi @MadhukarMa1,

 

You can manage your request by using JS to control de behaviour of the input form based on the value selected in the drop down-field.

An approach that you can follow is inside your script inserting a custom disableAllFields() function, that acts like a 'lock' button. It passes through all  the fields in the form and turns them read-only when the  selected value in the dropdown is 'Archive'. So, once 'Archive' is chosen, no one should not be able to make changes to the form.

 

On the other hand, for the "Active " Status, you can use the setAttribute method to disable specific fields, like locking certain parts of the form while leaving others editable.

 

Lastly, I share with you useful documentation links, that can help you:

Set attribute method 

Document: forms property 

FormElement 

JavaScript scripts and templates 

 

¡Hope it helps you!

 

Regards,

Celia