Lambda function is using JavaScript
We want a drop down button which list of requests
When ever we select a request in from the drop down it should update in the query before running the query
After finishing the query execution it should not reset the service name drop down
exports.handler = function myFunction(event,context) {
var x = document.getElementById("mySelect").value;
selectService=x
}
<tr>
<td>Select Service</td><td><select id="mySelect" name="selectService" onchange="myFunction()">
<option selected="${selectService==="END"?"selected":""}" value="END">END</option>
<option selected="${selectService==="START"?"selected":""}" value="START">START</option>
</select></td>
</tr>
Hi @Indranil I am trying to create a custom widget for log queries in cloudwatch which uses a lambda function. We are creating a dropdown in the lamda to select the service to filter the logs. We are able to get the values in dropdown. But whenever we select the service from the dropdown it is not updating in the actual query. For this we have created a onchange function but the function is not getting invoked when select the service from the dropdown
Thanks for the clarification. Does your lambda function return Javascript? If that is the case, then As per the documentation https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/add_custom_widget_dashboard_security.html , "For security reasons, JavaScript is not allowed in the returned HTML."
There are however other means to have interactivity in the custom widget, as mentioned here - https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/add_custom_widget_dashboard_interactivity.html.