If you are unable to create a new account, please email support@bspsoftware.com

 

Restrict to enter only 4 digits in TextBox Prompt in Cognos 8.4.1 in PromptPage.

Started by joseph123, 29 Sep 2011 06:58:53 PM

Previous topic - Next topic

joseph123

Hi all,

I am assuming there should be some JavaScript to restrict entering length of digits/characters under Textbox Prompt in Prompt Page.
In my report I need to hide entering more than 4 digits/characters, possibly it's better if we can prompt a message saying 'Enter only 4 digits'.

Appreciate your help.

Thanks and regards,
Venkat

joseph123


blom0344

I'm no Javascript expert and I am not sure that you're not trying to 'pull our leg' ,but if it is possible to enter both digits and characters, then data entered  can both be tested as digit  (filter < 10000) or by length of the string (4 characters).

Based on this validation you can return a report page with the message:

Just 4 charaCTERS!!!

or return the proper report page with data (by using a boolean to render either page)

cognostechie

In addition to what Blom suggestesd, you can also re-size the Textbox to a size that would allow entering only 4 characters.

CognosPaul

Try something like:

<script>
getFormWarpRequest()._textEditBoxPROMPT_NAME.maxLength=4;
</script>


replacing PROMPT_NAME with the name of the prompt object (not the parameter name).

joseph123

Paul,

Thanks for your reply.

function .maxlength=4; will work from 0 to 4 digits, however I need exactly 4 digits (Eg: 2011).

Appreciate your reply.

Thanks,

joseph123