Author Topic: Text Box Prompt  (Read 254 times)

Offline rajurokz

  • Full Member
  • ***
  • Join Date: Mar 2016
  • Posts: 19
  • Forum Citizenship: +0/-0
Text Box Prompt
« on: 18 Apr 2018 10:48:43 am »
Hi All,

I need to restrict a text box prompt which uses the loan number with a min of 4 digits and max of 14.

Also, I'm using a text box prompt to display date in MM/DD/YYYY format.

thanks,
Rajurokz

Offline Reinhard

  • Community Leader
  • *****
  • Join Date: Nov 2017
  • Posts: 123
  • Forum Citizenship: +0/-0
Re: Text Box Prompt
« Reply #1 on: 18 Apr 2018 02:00:29 pm »
Hi,

you could use a boolean variable that checks the length of your parameter by simply making the condition

?parameter? > 999 AND ?parameter? < 10000000000000

You put that variable in a conditional block and if it is true you show the content of the report and if not you show an "error page" with a statement.

regards,
Reinhard

Offline Reinhard

  • Community Leader
  • *****
  • Join Date: Nov 2017
  • Posts: 123
  • Forum Citizenship: +0/-0
Re: Text Box Prompt
« Reply #2 on: 18 Apr 2018 02:02:00 pm »
The same with the date. Otherwise you can only set in the properties that only numbers are allowed but if you insist on some check after pressing finish then I would try javascript.

Offline rajurokz

  • Full Member
  • ***
  • Join Date: Mar 2016
  • Posts: 19
  • Forum Citizenship: +0/-0
Re: Text Box Prompt
« Reply #3 on: 18 Apr 2018 03:44:46 pm »
Can you help me with the JavaScript please!

Offline dougp

  • Statesman
  • ******
  • Join Date: Jul 2014
  • Posts: 293
  • Forum Citizenship: +15/-1
Re: Text Box Prompt
« Reply #4 on: 18 Apr 2018 07:05:19 pm »
See the Cognos Prompt API documentation -- specifically the doc on the setValidator method.

And, before you ask... The documentation for the Prompt API did not change from 10 to 11.

 


       
Twittear