In the previous example, the first line of value prompt shows the data item name, that is, Month key (Shipment date).
The business wants to change this to a more generic and user-friendly text.
We need to add a line to the JavaScript from the previous recipe to change the text of first option (index 0). For that, open the prompt page of the report created in the previous recipe.
Double-click on the HTML item in the prompt footer.
Replace the code with the following:
<script> var theSpan = document.getElementById("A1"); var a = theSpan.getElementsByTagName("select"); for( var i = a.length-1; i >= 0; i-- ) { var prompts = a[i]; if( prompts.id.match(/PRMT_SV_/)) { prompts.selectedIndex = 3; prompts.options[0].text = 'Choose Shipment Month'; /* This is the new line added to script */ } canSubmitPrompt(); } </script>
Run the report to test it.