As far as the 1st question goes, one way is to insert a HTML item on your prompt page using some (or all) of the following code. This code in addition for checking date sequence also provide default values for the 2 dates.
<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() == 'p_fromdate' ){
eval('pickerControl' + cntlName.m_sRef + '.lostFocus()');
par1 = cntlName.m_oForm.value;
}
if ( cntlName.m_oSubmit.name.toLowerCase() == 'p_thrudate' ){
eval('pickerControl' + cntlName.m_sRef + '.lostFocus()');
par2 = cntlName.m_oForm.value;
}
}
if (par1<=par2)
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);
dw = new Date();
dt = new Date( dw - 1*86400000);
df = new Date( dw - 7*86400000);
if (cntlName.m_oSubmit.name.toLowerCase() == 'p_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_thrudate' ){
cntlName.m_oEditBox.value = dt.getFullYear()
+ '-' + right('0'+(1+dt.getMonth()),2)
+ '-' + right('0'+dt.getDate(),2);
eval('pickerControl' + cntlName.m_sRef + '.lostFocus()');
}
}
</script>
The Javascript above references your 2 dates as 'p_' plus your actual prompt names. In this example my dates on the prompt page are 'fromdate' & 'thrudate' and referenced in the script as 'p_fromdate' & 'p_thrudate'
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.