Power Pages - Make Multi-Select Fields Read only on Power Portals

Hello and welcome to another Javascript post on Power Pages.

You can easily find posts on how to set attributes as read-only on Power Pages, but setting a multi-select field as read-only is a little bit challenging.




Set Text Field Read Only

$("#<attribute name>").attr("readonly", true);

Set Multi-Select Read Only

$("<div></div>").css({
  position: "absolute",
  width: "100%",
  height: "100%",
  top: 0,
  left: 0,
  background: ""
}).appendTo($(".control").css("position", "relative"));

By using the code above, you can easily set the multi-select field as read-only this won't hide the selected options.

Comments

Popular posts from this blog

How to Use Pre-Image in Power Automate

Power Apps - Trigger Power Automate Flow On Approval Reassign

Power Pages - Multi Select Field Show Hide and Set Business Required Using Javascript