You are viewing limited content. For full access, please sign in.

Question

Question

Read-Only Not Being Set on Dropdown Field

asked on May 22, 2014

I am using the following JavaScript to set fields as Read-only. When adding the class read-only to a fields CSS value, it should make the field read-only. The problem is that it does not seem to be getting applied to drop-down fields.

//make fields with read-only class read-only
  $(".read-only *").prop("readonly", true);

Am I missing something?

0 0

Answer

APPROVED ANSWER SELECTED ANSWER
replied on May 23, 2014

You need to disable drop-downs instead of making them read only.

 

$(document).ready(function () {
  $('.read-only input').attr('readonly',true);
  $('.read-only select').attr('disabled',true);
});

 

2 0
replied on May 11, 2023

This is causing the value of the variable to be empty in the process model which is really not the intention. I am looking for a way to make it simply so that a user can not change the value of a field but without erasing the data on the backend.

0 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.