Populate choice list in a widget in html field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2020 03:20 AM
I have a field named "department types " of type "choice" in a user-defined table. I need to populate this field into a dropdown field in my widget portal. I am aware of this snrecordpicker, but to my knowledge I thinks it works with field of type "reference". I have heard about this ng.options. But I couldn't find any proper docs. Could someone please help me
- Labels:
-
Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2020 03:29 AM
Hey Lavanya,
You can populate the dropdown with options from client script using an array, and set the default selected option by setting the ng-model variable (c.data.personalDetail.LevelOfAccess) as the desired cell in the array.
Here is example code:
HTML:
<select id="mySelect" ng-init="c.data.personalDetail.LevelOfAccess = c.options[0]" ng-model="c.data.personalDetail.LevelOfAccess" ng-options="option.name for option in options" required></select>
Client script:
c.options = [{
name: 'None',
value: 'none'
}, {
name: 'Admin',
value: 'admin'
}, {
name: 'User',
value: 'user'
}];
You can get the currently selected option from client script using c.data.personalDetail.LevelOfAccess.value
For more details Refer the Link below:
HOPE THIS HELPS!!!!
Mark Correct and Helpful if you find my response Worthy!!!
Best Regards,
Namrata.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2020 03:37 AM
The choice entries are already in the field "department types" in the user defineed table. I just want to load the choice entries/options in the dropdown. My question is how I populate that options from that table. But here you are giving the options in the client script. I have the options already in the field