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

Question

Question

read only fields javascript

asked on April 20, 2017 Show version history

Hello,

Is there a way to put a field in read-only based on another field value via JavaScript?

 

Regards,

Guillaume

0 0

Replies

replied on April 21, 2017

Hi Guillaume,

 

Yes, you can do that.  Just replace the Field references with the actual selectors, and the requirement in the IF statement with the value you are looking for.

 

$(document).ready(function() {
  $("#Field1").on('change', function () {
    if ($(this).val() == "1")
      $("#Field2").prop("readonly", true);
  });
});

 

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

Sign in to reply to this post.