Hi Friends,
I need a java script to update year and month on the prompt page. It should select previous month. If sys date is 2010 Jan then it should select 2009 Dec. I am having list box value prompts for both year and month. I think I am doing something wrong in the java script. Can someone please correct me.
Also Year prompt is howing years like 2008,2009,....2013 which is coming from a query item assigned to prompt. Ans month is static choices use value as 1 display value as jan... and so on.
Following are the java scripts that I am using right now:
YEAR
<script language="javascript">
function alert() {}
var dt = new Date();
var year = dt.getYear();
var mnt = dt.getMonth();
if (year = 2 )
{
year = year-1
}
else
{
year = year
}
var form = getFormWarpRequest();
var dropDownL = form._oLstChoicestoyear;
dropDownL.options(year).selected=true;
canSubmitPrompt();
</script>
MONTH
<script language="javascript">
function alert() {}
var dt = new Date();
var mnt = dt.getMonth()-1;
if (mnt = 1)
{
mnt=11
}
else
{
mnt = mnt
}
var form = getFormWarpRequest();
var dropDownL = form._oLstChoicestomonth;
dropDownL.options(mnt).selected=true;
canSubmitPrompt();
</script>
Regards
Sumeir