Hi All,
I have a requirement to have a report with 2 prompts but only one of them should be answered.
If I mark both of them as "required" then I need to answer both of them.
If I mark both of them as "optional" , it works , but user can skip both of them as well
I have also found the following solution for my prob in this forum but there is something wrong with it.
Can somebody help me with the content of this HTML?
this HTML item appears with the shape of a button with the label of Finish at run time but when I hit it no action will happen!
My solution:
I named my 2 prompts in their Miscellaneous/Name VP_1 and VP_2.
I named my Finish button in its Miscellaneous/Name PromptButtonFinish.
In my report prompt page I inserted an HTML item and have typed the following script in it.
<input type="BUTTON" class="clsPromptButton" onClick="customCheckPage()" value=" Finish ">
<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 to check prompts before submission
function customCheckPage()
{ var fillCount; fillCount = 0;
for( var i=0; i<preProcessControlArray.length; i++)
{ cntlName = eval(preProcessControlArray);
if (cntlName.m_oSubmitField && cntlName.m_oSubmitField.name.toLowerCase() == 'VP_1' )
{ cntlName.m_oFormField.lostFocus; if(cntlName.m_oFormField.value.length >0)
fillCount++; }
if (cntlName.m_oSubmitField && cntlName.m_oSubmitField.name.toLowerCase() == 'VP_2' )
{ cntlName.m_oFormField.lostFocus;
if(cntlName.m_oFormField.value.length >0)
fillCount++; }
}
}
if (fillCount == 1) promptButtonFinish();
else
alert('Please enter only one of the following: VP 1 , VP 2'); } // Find 'Finish' Button and replace submit method with custom function above
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>
Thanks,
Rez
I have a requirement to have a report with 2 prompts but only one of them should be answered.
If I mark both of them as "required" then I need to answer both of them.
If I mark both of them as "optional" , it works , but user can skip both of them as well
I have also found the following solution for my prob in this forum but there is something wrong with it.
Can somebody help me with the content of this HTML?
this HTML item appears with the shape of a button with the label of Finish at run time but when I hit it no action will happen!
My solution:
I named my 2 prompts in their Miscellaneous/Name VP_1 and VP_2.
I named my Finish button in its Miscellaneous/Name PromptButtonFinish.
In my report prompt page I inserted an HTML item and have typed the following script in it.
<input type="BUTTON" class="clsPromptButton" onClick="customCheckPage()" value=" Finish ">
<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 to check prompts before submission
function customCheckPage()
{ var fillCount; fillCount = 0;
for( var i=0; i<preProcessControlArray.length; i++)
{ cntlName = eval(preProcessControlArray);
if (cntlName.m_oSubmitField && cntlName.m_oSubmitField.name.toLowerCase() == 'VP_1' )
{ cntlName.m_oFormField.lostFocus; if(cntlName.m_oFormField.value.length >0)
fillCount++; }
if (cntlName.m_oSubmitField && cntlName.m_oSubmitField.name.toLowerCase() == 'VP_2' )
{ cntlName.m_oFormField.lostFocus;
if(cntlName.m_oFormField.value.length >0)
fillCount++; }
}
}
if (fillCount == 1) promptButtonFinish();
else
alert('Please enter only one of the following: VP 1 , VP 2'); } // Find 'Finish' Button and replace submit method with custom function above
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>
Thanks,
Rez