Author Topic: Controlling Prompts with JavaScript  (Read 192 times)

Online dougp

  • Statesman
  • ******
  • Join Date: Jul 2014
  • Posts: 341
  • Forum Citizenship: +18/-1
Controlling Prompts with JavaScript
« on: 13 Jul 2018 05:49:24 pm »
I want more control over my prompt pages.

For example, I want to set all of my prompts to "not required" and parameterized filters to "optional" because there is no one prompt that should be required.  However, I don't want to allow the user to download the internet.  They should have to use some prompts, just not specific ones.  Maybe I want them to filter the report by a city and a year, or maybe a country and a month.  If I require city, they can't see the whole country without selecting every city in that country.  Painful.

Or maybe I just want to always has my date prompt default to one week ago, or maybe the last work day before today.

I have much of my prompt script worked out, but here are a few items I'm having trouble with.

  • Identifying which button (cancel, back, next, reprompt, finish) the user clicked that caused the script to enter the PageModule.hide() method.
  • Making a prompt validation function to run as described in the documentation for the PromptControl.setValidator() method.
    • Date (and DateTime?) prompts don't appear to use validators at all.
    • If a textbox prompt is empty because the user just deleted the content, the validator doesn't run.

Does anyone else here have experience with this?  Do you have the same problem?  Are there other problems I haven't noticed yet?  Did you find workarounds?