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

date validation

Started by pooja, 30 Dec 2009 06:59:51 PM

Previous topic - Next topic

pooja

java script for date validation in prompt page From date and To date prompt.??

thankx in advance


pooja


MFGF

Go to the top level on the forum, use the search field in the top right corner, and enter javascript date.

Isn't that much easier than posting angry faces because nobody has as yet replied?

MF.
Meep!

Sreeni P

Check this Java script

<script>
var cntlName;
function right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}
function customCheckPage(){
var par1;
var par2;
for( var i=0; i<preProcessControlArray.length; i++){
  cntlName = eval(preProcessControlArray);
  if ( cntlName.m_oSubmit.name.toLowerCase() == '' ){
    eval('pickerControl' + cntlName.m_sRef + '.lostFocus()');
    par1 = cntlName.m_oForm.value;
  }   
  if ( cntlName.m_oSubmit.name.toLowerCase() == 'p_p_par_todate' ){
    eval('pickerControl' + cntlName.m_sRef + '.lostFocus()');
    par2 = cntlName.m_oForm.value;
  }
}

if (par1<=par2) {
  //alert ('CORRECT');   
  promptButtonFinish();
} else {
  alert('FROM DATE parameter must be smaller than or equal to TO DATE parameter!');
}

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;
  }
}
for( var i=0; i<preProcessControlArray.length; i++){
  cntlName = eval(preProcessControlArray);
  dt = new Date();
  df = new Date( dt - 30*86400000);
  if (cntlName.m_oSubmit.name.toLowerCase() == 'p_par_fromdate' ){
    cntlName.m_oEditBox.value = df.getFullYear()
         + '-' + right('0'+(1+df.getMonth()),2)
         + '-' + right('0'+df.getDate(),2);
    eval('pickerControl' + cntlName.m_sRef + '.lostFocus()');
  }
  if (cntlName.m_oSubmit.name.toLowerCase() == 'p_par_todate' ){
    cntlName.m_oEditBox.value = dt.getFullYear()
         + '-' + right('0'+(1+dt.getMonth()),2)
         + '-' + right('0'+dt.getDate(),2);
    eval('pickerControl' + cntlName.m_sRef + '.lostFocus()');
  }
}
</script>



here the parameters i used :p_par_fromdate(from date)  ,  p_par_todate(to date)


and one more final thing .....................for this script we should thank to "COGNOiSe administrator"

s_thammi@yahoo.com

when I use the above script I am getting error message.

preProcessControlArray is undefined. Does any one know how to fix this?

Thank you
Sridhar

s_thammi@yahoo.com

I am using congos 8.4