using vs. 8.4.1
I have two value prompts on the report page, one for year and one for month.
I want the value prompt's default selection to be the max(Year) and max(Month) that are available in the DB2 table.
What is the javascript code to do this?
Thanks!
In case anyone else needs it, I found code that works!
<script type="text/javascript">
var promptValue;
var fW = (typeof getFormWarpRequest == "function" ? getFormWarpRequest() : document.forms["formWarpRequest"]);
if ( !fW || fW == undefined) { fW = ( formWarpRequest_THIS_ ? formWarpRequest_THIS_ : formWarpRequest_NS_ );}
var prompt = fW._oLstChoices<FieldName>;
// prompt.value.length will be 0 on load when nothing has been chosen
// This is the only time we want to set it or it will always return to our default value
if (prompt.value.length==0)
{
/* for (i = 0; i < prompt.options.length; i++)
{
alert(promptValue + ' ' + prompt.options[2].text)
if (prompt.options[2].text == promptValue)
{
prompt.options[2].selected = true;
}
}*/
prompt.options[2].selected = true;
promptAction('finish');
}
</script>