on 2019 Oct 16 8:06 AM
Hi All,
I am using the latest SAP MDK SDK 3.2.0 version and trying to disable or hide a field, based on another field value entered/selected by the user in the same edit page of an MDK application.
Trying to get this dynamically. For example, I have two simple property fields in a Form cell edit page:
1. FCCountry
2. FCName.
And when I change the ‘FCName’ field value to ‘Carolyn’, ‘FCCountry’ must get disabled for editing. The below rule is written in the ‘Iseditable’ property of ‘FCCountry’ field, but does not work as expected. Please help with your valuable suggestions.
Something like this should work, put this function in onValueChange event of your FCName control. I'm just not sure it is the best way...
export default function setFCNameEditable(clientAPI) {
var fieldValue = clientAPI.evaluateTargetPath('#Page:FormEditLink/#Control:FCName/#Value');
var element = clientAPI.evaluateTargetPath('#Page:FormEditLink/#Control:FCCountry');
if (fieldValue == 'Carolyn') {
element.setEditable(false);
element.redraw();
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sangulin,
Thank you for the prompt response.
In the above rule, the 'fieldValue' variable takes the current page 'FCName' field value, but the setEditable() function does not set 'FCCountry' field as editable/disabled based on the current page 'FCName' field value.
Also, tried to get the control name using the page proxy in 'onValueChange' event, as shown in the below link. This also fails. Please let me know if you have any suggestions here.
setenabledrule.pngHi Sangulin,
I just tried again and found the ‘FCCountry’ field gets disabled, when I delete the existing ‘FCName’ value ‘Carolyn’ in edit page and type the name again. And when I change the name again to some other name, the ‘FCCountry’ field remains disabled for edit. Is there a way we can switch the ‘FCCountry’ field property between enabled or disabled, each time we edit the ‘FCName’ value?
Again, thank you for the inputs.
Were you able to resolve your issue? If so, please post an answer so others might benefit from your findings.
User | Count |
---|---|
68 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.