Announcements
Hi,
I have tried many different ways to implement this but I am unable to achieve desired result. Please guide me if you have come across this with a good solution.
I have form with two options field. I am trying to lock this two options field once the user makes a choice and saves the form. That means he has locked his choice.
So, far I tried a business rule and a client side script to lock the field on change of the same field. What's happening is it locks as soon as I click on the field and even before saving the form. That means if user makes a choice by mistake he can't revert back. And I can't implement it through plugin either. So, I am kind of stuck as to how best to implement this! Am I thinking through in the right direction? or is there a better way to handle this usecase? Please suggest.
Thanks for any help!
Hi,
You can replace the On Change event with the On Save event. If you want to add the On Save event, you can click on the entire form instead of a specific field:
Add On save event:
JavaScript Code:
function disableField(executionContext){ var formContext = executionContext.getFormContext(); formContext.getControl("frank123_duration").setDisabled(true); }
Before saving:
After saving:
Hi,
if the field type is two options, that means there is always a default value set (either 1 or 0), so your requirement is like a check box, where when user set it to Yes and save then never allow users to uncheck.
If my above understanding is correct, then you must make the field read-only on onload of the form by following condition
if(formtype ==2)//updateform
{
if(myfieldValue == 1)
{
setDisable the field here;
}
}.
If event is set on onchange of the field, then users may not be able to make change. so the field should be set disable on onload.
André Arnaud de Cal... 291,359 Super User 2024 Season 2
Martin Dráb 230,370 Most Valuable Professional
nmaenpaa 101,156