COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: joseph123 on 29 Sep 2011 06:58:53 PM

Title: Restrict to enter only 4 digits in TextBox Prompt in Cognos 8.4.1 in PromptPage.
Post by: joseph123 on 29 Sep 2011 06:58:53 PM
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
Title: Re: Restrict to enter only 4 digits in TextBox Prompt in Cognos 8.4.1 in PromptPage.
Post by: joseph123 on 30 Sep 2011 11:35:32 AM
Can any one help on this.
Title: Re: Restrict to enter only 4 digits in TextBox Prompt in Cognos 8.4.1 in PromptPage.
Post by: blom0344 on 30 Sep 2011 02:03:35 PM
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)
Title: Re: Restrict to enter only 4 digits in TextBox Prompt in Cognos 8.4.1 in PromptPage.
Post by: cognostechie on 30 Sep 2011 02:18:40 PM
In addition to what Blom suggestesd, you can also re-size the Textbox to a size that would allow entering only 4 characters.
Title: Re: Restrict to enter only 4 digits in TextBox Prompt in Cognos 8.4.1 in PromptPage.
Post by: CognosPaul on 02 Oct 2011 08:24:14 AM
Try something like:

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


replacing PROMPT_NAME with the name of the prompt object (not the parameter name).
Title: Re: Restrict to enter only 4 digits in TextBox Prompt in Cognos 8.4.1 in PromptPage.
Post by: joseph123 on 03 Oct 2011 04:44:37 PM
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,
Title: Re: Restrict to enter only 4 digits in TextBox Prompt in Cognos 8.4.1 in PromptPage.
Post by: joseph123 on 11 Oct 2011 07:23:48 PM
Hi Techies

Does any have solution for my problem.

Regards,
Joseph