in an entity ive set a Max Students Number field, i need to make it editable only when creating the form, and make it read-only right after saving the form
how to do that?
when i set the field as read-only i cant edit it at all when creating a new form, i need to be able to set a value to it on create - then change it to read-only
i saw setsubmitmode but did not understand how to use it
here's what im stuck at so far in writing the function thats supposed to do it: (if possible without code id wish to know as well)
Hello,
I hope you are doing well.
Also is possible to use security profile of fields such as docs.microsoft.com/.../field-level-security.
In this situation is ensured that user can't change your rule, based on JavaScript can be changed on DEVTools on browser.
Kind Regards,
Hi,
You need to check the formtype using formContext.ui.getFormType(). docs.microsoft.com/.../getformtype
If formtype value is 1 i.e Create, you can enable the field formContext.ui.controls.get("your field name").setDisabled (false);
else you can disable your field formContext.ui.controls.get("your field name").setDisabled (true); .
Please mark as verified if the answer is useful.
Hi,
As MicroDynamicalCRM said, you can use getFormType to get the form type, you can refer to the following official documents:
getFormType (Client API reference) in model-driven apps - Power Apps | Microsoft Docs
If this helped you, I'd appreciate it if you'd mark this as a Verified Answer, which may in turn help others as well.
Best Regards,
Frank Gong
Update Edit:
i've just read about GetFormType()
now i know what to do:
get the form type and setDisabled to false when the formtype value is "create" , and true elsewhere.
problem solved
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,522 Super User 2024 Season 2
Martin Dráb 228,441 Most Valuable Professional
nmaenpaa 101,148