Hi,
I'm supposed to come up with a solution to a problem that involves forcing users to select a value in one of three ways:
- The first way is entering a value in a text box.
- The second option is first selecting a value in a combobox which gets a list of values for a cascading prompt from which the user then selects the value on which data for the report will be filtered.
- Option three is selecting a value through a search and select prompt. After entering a search string the user selects the value in the returned results.
One and only one of the three options
must be used. Is there any way to force selection for a group of prompts that are individually optional prompts? So the group acts as a logical mandatory prompt, but it's members are optional. The solution should preferably work without altering the cognos javascript include files that reside on the server. If there is a solution does it work for Cognos8, ReportNet 1.x or both?
regards,
crossjoin
I think you would need to implement this as a Javascript validation, wired into the Finish button on your prompt page. I haven't done any of this myself but from what I've read it's possible (should be so in both environments). Try searching this and other forums for "date validation", validating end-date-greater-than-start-date seems to come up a lot and might give you some ideas for the approach, though not the specifics of the code.
Thanks for trying to help, almeids :)
You didn't actually point out anything new to me, but the effort is appreciated regardless.
However, I have found something that seems to work with a custom Finish button.
<script>
function customCheckPage(){
var parcount = 0;
if (document.getElementById("_textEditBoxtxtAct").value.length > 0) {
parcount = parcount + 1;
}
if (document.getElementById("_oLstChoicescboAct").value.length > 0) {
parcount = parcount + 1;
}
if (document.getElementById("_sws_myparam_search_selectChoicessspAct").value.length > 0) {
parcount = parcount + 1;
}
if (parcount == 1) {
promptButtonFinish();
}
else if (parcount == 0) {
alert("You have not selected a value!\n Select a value in one of the prompts.");
}
else {
alert("You used more than one prompt!\n Please use only one prompt.");
}
}
</script>
<button onclick="customCheckPage()"
style=""
class="clsPromptButton"
onmouseover="this.className = 'clsPromptButtonOver'"
onmouseout="this.className = 'clsPromptButton'">Finish</button>
What would be nice is to disable the Finish button and only show it when in only one prompt a value is selected. Maybe trapping click and keypress events can help out to achieve that.