Hi all,
I have a dropdown field and have a condition for disbaled, based on that it will be disabled or not.--> if it's not null or empty it's working fine
--> if it's null or empty, the dropdown is not disabled and I'm able to select a value for first time. Once I select the value, the dropdown gets disabled. ( since it considers that the field is not null and it's disabled. But I want the field to be editable) Can someone please help here.
disabled: { if(a!isnullormepty(ri!record[my dropdown field])false, true ), },
Discussion posts and replies are publicly visible
This is confusing me! Why do you want to disable the field based on whether the selected value is null?
not based on the selected value. sometimes the field will be populated will a record is created and sometimes not.
Can you share the code snippet of that dropdown?
disabled: { if(and( a!isNullOrEmpty( ri!record[] ),
local!isvalueavailable), false, true ), },
Please share your code for the entire dropdown. And as Stefan mentioned, please use a Code Box to enable us to see proper formatting and indentation.
a!dropdownField( label: "dropdown", choiceLabels: {}, choiceValues: {}, value: ri!record[fieldname], saveInto: ri!record[fieldname], disabled: { if( and( a!isNullOrEmpty( ri!record[], ), local!isValueAvailable ), false, true ), }, required: true )
Is that the real code? Line 11 does not look correct.
I didn;t mention the exact field here. But in my code I am referring to the dropdown field
OK. Then I need to repeat my question. Why do you make disabled depending on whether a value is selected?
Unknown said:Is that the real code?
consider that Record Type code (when copied/pasted to plaintext) looks like incomprehensible gobbledygook - so most folks understandably obfuscate that stuff out. Sad that we have to resort to such measures just to post code here, but meh...
Unknown said:Why do you make disabled depending on whether a value is selected?
I'd ask it this way: what is the actual behavior you're wanting, and in exactly what way is your current implementation failing to do what you want? I can't quite tell either of these things based on your original post.
My requirement here is, I pull the data from the external system. After pulling the data, when I view the record somteimes the dropdown field might get a value from the external system and sometimes it will be empty.If the field is empty, then the user can select values from the dropdown. If the field is not empty (populated by the external system) then I want to disable the field, so that user can change the value
In my case, when I pull the data from the external system the field is blank. So the user can select the value from the dropdown. But once after I select a value from a dropdown, it's getting disabled ( I think it's because it checks the condition isnotnullorempty and it's getting disabled). But I want to remain it as a editable field ( since the data from the external system is blank)
hema.mathivathanan said:But I want to remain it as a editable field
So if you remove / comment the "disabled" parameter, it will remain editable. What is your intention behind disabling it conditionally?
a!dropdownField( label: "dropdown", choiceLabels: {}, choiceValues: {}, value: ri!record[fieldname], saveInto: ri!record[fieldname], disabled: false(), /* this can either be "false()" or just removed if you never need it to be disabled */ required: true() )
You cannot combine that logic into one value. Let's dissect that.
You have a dropdown. In case you get a value from the external system, this value shall be disabled. Correct? So, you will have to check the data as it comes in and, in a separate local variable, define whether to disable that field. Then use that for the disabled parameter.
Then you can use the actual record field just for the purpose it is meant for. Store the selected value.