Hi,
I have textbox prompts and value prompts in my report. I have used Javascript in textbox prompt for validating the special characters entered in the textbox prompt and Javascript in value prompt for hiding the prompt parameter name of the value prompt. But this script works fine only for the first time and whenever I run the report for next time, the Javascripts doesnt work and validations for textbox prompt doesnot work.Also for value prompt it displays the prompt parameter name.
I have used the following javascript:
Textbox prompt :
<script language="javascript">
function TextboxSplChar()
{
var iChars = "!@#$%^&*+=;,.{}|:<>?";
for (var i = 0; i < document.forms[0].elements["_textEditBoxCatalogNo"].value.length; i++) {
if (iChars.indexOf(document.forms[0].elements["_textEditBoxCatalogNo11111"].value.charAt(i)) != -1) {
alert ("You have entered special characters. \nThese are not allowed.\n Please remove them and try again.");
return false;
}
}
}
document.forms[0].elements["_textEditBoxCatalogNo11111"].onchange=TextboxSplChar;
</script>
Value prompt:
<script>
mylist = document.forms[0].elements["_oLstChoicesPLINE"];
mylist.remove(0);
mylist.onchange();
</script>
Any help will be appreciated.
Regards,
Dipstm
Hi,
Try to use the following insted of "document.forms[0]". I know it does the same thing but
i saw some weird things happening.
document.getElementById('formWarpRequestRS').
HTH
Hi,
I tried using as u mentioned but its not working. I guess there is something wrong using Javascripts in Cognos 8.3
Any suggestions .....
Regards,
dipstsm
Hi,
I have used the following script to remove the parameter name from the listbox values.
document.getElementById('formWarpRequestRS')._oLstChoicesXXX.options[0]=null;
where XXX is the name of the value prompt.
HTH
Satish