If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Java script needed to validate 2 date prompts.

Started by vijaypamidi, 04 Jun 2009 05:02:49 AM

Previous topic - Next topic

vijaypamidi

Hi,

I have 2 date prompts in my Report
Start Date,End date
If the user selects Start date> End Date then
a pop message should Popup saying
'Please select start date lessthan End date'

Thanks,
Vijay.P

Shailaja0520

<script>
function customCheckPage(){
var par1;
var par2;
for( var i=0; i<preProcessControlArray.length; i++){
  cntlName = eval(preProcessControlArray);
  if ( cntlName.m_oSubmit.name.toLowerCase() == 'p_paramater name for start date'){
   par1 = cntlName.m_oForm.value;   
   eval('pickerControl' + cntlName.m_sRef + '.lostFocus()');
  }
  if ( cntlName.m_oSubmit.name.toLowerCase() == 'p_paramater name for end date'){
   par2 = cntlName.m_oForm.value;   
   eval('pickerControl' + cntlName.m_sRef + '.lostFocus()');
  }
}
  if (par1<=par2)
    promptButtonFinish();
  else
    alert('Start Date must be less than or equal to End Date !');
}
for( var i=0; i<pageNavigationObserverArray.length; i++){
  cntlName = eval( pageNavigationObserverArray );
  if(cntlName.m_oParent.onclick.toString().indexOf('promptButtonFinish()')>0 ){
    cntlName.m_oParent.onclick = customCheckPage;
  }
}
</script>

david.stachon

....if it were me, I wouldn't do this with 2 prompts/parameters.

Use:

[my date] in_range ?p my_date?

...this will then generate the date range prompt object.

Unfortunately, it still won't stop a user from entering a "from date" that's greater than your "to date" ....but seriously, is it worth a whole load of extra code to prevent a user from doing this?

Shailaja0520

Hi Can u help in this --
help me out in knowing how to initialize a date Range prompt.

Let me explain the scenario..

I have a drill through report. I have a date range prompt in the child report assigned to a parameter say ?P1?

Now I am suppose to pass a value to this parameter ?P1?

Note:
1. I am not suppose to make any change to the child report.
2. In the parent report I have three kind of prompts:
    Two date prompts- for start date and End Date(enabled only when my time bucket selected is Daily)
    Two value prompts- For week start date and week end date ( enabled only when my time bucket selected is weekly)
    Two value prompts- for start month and end Month(enabled only when my time bucket selected is Monthly)