I tried using an action-number control in my new ScriptyLightbox2, but
found that I couldn’t seem to leave it empty. I wanted it to allow a
null entry (not 0) and it just doesn’t seem to allow that. I switched
back to an action-text control instead, but that’s not ideal, because
it doesn’t enforce a numerical input.
action-number does indeed only accept numbers. If you need to enforce numerical input and allow the empty string you will need to use action-text and do some management in fwParamterChanged. The following should do the job:
I tried using an action-number control in my new ScriptyLightbox2, but found that I couldn’t seem to leave it empty. I wanted it to allow a null entry (not 0) and it just doesn’t seem to allow that. I switched back to an action-text control instead, but that’s not ideal, because it doesn’t enforce a numerical input.
Hi Walter,
Joe’s suggestion of using fwParameterChanged is the most elegant as you can roll your own input validation to do what ever you like.
Another solution, and one I’ve used in the past, would be to set a checkbox next to the action-number control that sets the field’s enabled state;
You would then use something like this in fwInterface to control the state of the number input;
function fwInterface(){
var myNumberActive = fwParameters["myUndefinedNumber"].fwBoolValue;
fwParameters["myNumber"].fwEnable = myNumberActive;
}
…and switch accordingly when it comes to reading the number of null value when your main function runs.
The only advantage this solution has over Joe’s is possibly that the input options are made clear to the user although I guess that could be overcome with good labelling or default values.
Regards,
Tim.