web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Javascript Lock Field ...
Power Pages
Unanswered

Javascript Lock Field on Power Pages

(0) ShareShare
ReportReport
Posted on by 19

I am new to power pages and have a page created with some fields on it. I am trying to gray out a field so it cannot be edited and need to use javascript to do it.

 

I have attempted to use the following which I know is not correct, and that's why I am here. 

 

Screenshot 2023-05-06 at 9.30.22 PM.png

 

When I test it, the Alert pops up.....

Screenshot 2023-05-06 at 9.32.29 PM.png

 

but the field doesn't lock once I click OK

Screenshot 2023-05-06 at 9.33.31 PM.png

 

How do I lock this field so it cannot be edited using javascript exactly? 

 

Ant guidance would be greatly appreciated. 

Categories:
I have the same question (0)
  • Verified answer
    Inogic Profile Picture
    1,135 Super User 2025 Season 2 on at

    Hi @ACECORP , 

     

    As per our understandings, you want to disable a Field on portal so that user cannot make any changes to that field, 

     

    The changes should made via JavaScript only, for an example we have took Account Name field on the Account Form on portal and will disable the Field on the Portal.

     

    Please refer to the below screenshot for the same.

    Inogic_0-1683541112901.png

    You have to add the below code either on form itself (Advanced settings) or in edit code of the page where form is used, 


    $("#name").attr("readonly","readonly")

    Also, you can use below code which will show cursor blocked,

     $("#name").attr("disabled","disabled")

    Please follow below step to update the code in the Studio code.

    Inogic_1-1683541136153.png

     

    At last Save the changes and sync the portal changes. This will give you below output for the same.

     

    Inogic_2-1683541144847.png

    If this answer helps, please mark it as an Accepted Solution so it would help others to find the solution.


    Thanks!

    Inogic Professional Service Division

    An expert technical extension for your techno-functional business needs

    Power Platform/Dynamics 365 CRM

    Drop an email at crm@inogic.com

    Service:  http://www.inogic.com/services/ 

    Power Platform/Dynamics 365 CRM Tips and Tricks:  http://www.inogic.com/blog/

  • ACECORP Profile Picture
    19 on at

    That solved it. Thank you kindly!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Pages

#1
Jerry-IN Profile Picture

Jerry-IN 71

#2
Fubar Profile Picture

Fubar 62 Super User 2025 Season 2

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard