I noticed that when I used disable or readonly on select dropdown input fields nothing really changes. You can still select another item in the select list.
My goal is to allow the user to view the readonly or disabled data in the form, and only to be allowed to update the field of my choice.
Anyone have any ideas of how to prevent users inputing data into disabled or readonly inputs?
The select input does not support readonly.
You can however disable it using the disabled attribute. Note that the disabled inputs values are not being sent on form submit.
Well yes, that is how disabled inputs work
You should create a hidden input, having the same name and id as the disabled select and having the same value as the select. This way the hidden input value will be sent, when the select is disabled.
If it doesn’t suit the objective, I may just rebuild the update form to only include what needs to be updated and post the readonly items in a column above and outside the form.