Do you want your Action to ‘safely fail without doing anything’, or do you want to prevent the user from even being able to supply a bad value and prevent the Action from being taken at all?
The first is the easiest. In the Action Script itself
action parameter query "DAY" with description "Number of days cmd is valid " with default value "1"
continue if {exists (parameter "DAY" of action) whose (it as integer >= 1 and it as integer <= 7) }
If DAY is not an integer, or not between 1 and 7, the Action Script will exit at that point and the action result will be marked as Failed.
The second option is a bit harder. Well, at least harder to do in the Console. There is an option known as Parameterized Fixlet where one can actually put the operator input in an HTML textbox in the Description tab of the fixlet, and call a bit of JavaScript when the operator hits the “Take Action” button to either validate the value and proceed, or give them a message that they must enter or correct the value before the Action can be taken.
@JGStew has a writeup on using Parameterized Fixlets at How to use Parameterized Fixlets
The Console doesn’t have an editor for this, so you’d have to actually export a .BES file, modify the Description HTML and script there, and re-import it.
It’s a very powerful feature though - for example if you have OS Deployment and Bare Metal Imaging, a lot of the Tasks/Fixlets in that site use Session Relevance queries to populate HTML drop-down lists in those fixlets with the names of OS images you may deploy, so you can “choose” the image rather than having to know its name.