- Community Home
- >
- Software
- >
- HPE Morpheus Software
- >
- HPE Morpheus Enterprise Software
- >
- Forms, Options, Inputs, and Fun!
Categories
Company
Local Language
Forums
Discussions
- Integrity Servers
- Server Clustering
- HPE NonStop Compute
- HPE Apollo Systems
- High Performance Computing
Knowledge Base
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Knowledge Base
Forums
Discussions
- Cloud Mentoring and Education
- Software - General
- HPE OneView
- HPE Ezmeral Software platform
- HPE OpsRamp Software
Knowledge Base
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2023 07:07 AM
08-30-2023 07:07 AM
Forms, Options, Inputs, and Fun!
Recently, I was asked about using the API to get the list of values for an input. For the record, if you need that list, use the following API endpoint: /api/options/list?optionTypeId=:id This will be on the test later.
When dealing with forms, the inputs now only exist within that form. That is, if you aren’t using existing inputs. For the moment, we’ll pretend we aren’t. Since these options do not appear in the input listing, and even inspecting the element in the web developer console of your browser doesn’t yield an id, we need to do it in a slightly different way. Enter React Developer Tools. You can get that here for Firefox or here for Chromium based browsers.
In the forms dialog, inputs do not have an optionTypeId until you save and exit the form and reopen. Once you do, you’ll see something like the following in the normal inspect:
In the react component viewer in the web developer console, you’ll have to find the element, but they are highlighted as you go through the different components. Eventually, you’ll find the one you want and the key is right there in the react key:
If you select the value underneath it, “z” in this case, I can see the following for my input:
Even better, under the state you find all the names and values:
Now that I have my id, I can use the API call from earlier /api/options/list?optionTypeId=2340:
{
"success": true,
"data": [
{
"name": "v1.5.2",
"value": "https://api.github.com/repos/phpipam/phpipam/tarball/refs/tags/v1.5.2"
},
{
"name": "v1.5.1",
"value": "https://api.github.com/repos/phpipam/phpipam/tarball/refs/tags/v1.5.1"
},
{
"name": "v1.5.0",
"value": "https://api.github.com/repos/phpipam/phpipam/tarball/refs/tags/v1.5.0"
},
{
"name": "v1.4.7",
"value": "https://api.github.com/repos/phpipam/phpipam/tarball/refs/tags/v1.4.7"
},