I have this JSON Object.
{
"headerContent": [
{
"name": "User Id",
"key": "userId",
"type": "text",
"default": "Enter User Id"
},
{
"name": "User Name",
"key": "userName",
"type": "text",
"default": "Enter User Name"
},
{
"name": "Password",
"key": "password",
"type": "password",
"default": "Enter Password"
},
{
"name": "Mobile Number",
"key": "mobileNumber",
"type": "text",
"default": "Enter Mobile Number"
},
{
"name": "User Category",
"key": "userCategory",
"type": "select",
"default": "Select Category",
"options" : ["Admin", "Client", "Regulator"]
},
{
"name": "E-Mail",
"key": "email",
"type": "text",
"default": "Enter Email"
},
{
"name": "User Access",
"key": "userAccess",
"type": "select",
"default": "Select User Access",
"options" : ["All", "Site"]
}
],
"bodyContent": [
{
"userId": "user_1",
"userName": "DemoUser",
"mobileNumber": "99999999",
"userCategory" : "Admin",
"email" : "demo@kl.com",
"userAccess" : "All"
}
]
}
The headerContent
describes the attributes of bodyContent
.
Now, by default all data in the object (like user_1) will be displayed in details
. In the html page I have a select box containing 3 values [Admin, Client, Regulator]; which are 3 different user category. When I select any of them, I want to display data based on the selection.
My HTML page contains a select box to select the category.
<script src="JSCode.js"></script>
<select id='listSelect' onChange="updateList()">
<option value='' selected >All</option>
<option value='admin'>Admin</option>
<option value='client'>Client</option>
<option value='regulator'>Regulator</option>
</select>
<div id='details'> </div>