ronca
12th March 2009 16:55 UTC
Validity Plugin
I know how to create a custom page that prompts the user for numeric input.
I don't know however how to check that the user's input is valid (numeric) and whether it falls within a range that I define.
Is there a plugin that does this?
If not, what is the best way to handle such input?
Animaether
12th March 2009 17:00 UTC
if you're using nsDialogs to create the page, then just create a numeric text field (NSD_CreateNumber). That will limit input to numbers.
After that, you could put a NSD_OnChange on that numeric text field, get the text using NSD_GetText, and use IntCmp to check whether it falls outside a given range.. if it is, pop up a warning and clamp it to the maximum/minimum allowed value with NSD_SetText ?
ronca
12th March 2009 17:15 UTC
Yes I am using nsDialogs. No I didn't know about NSD_CreateNumber. Thanks Animaether.
In my search for numeric validation plugin I came across a plugin called Dialogs plug-in:
http://nsis.sourceforge.net/Dialogs_plug-in
I am wondering now why a special plugin for dialogs when there is nsDialogs?
Was this by any chance the plugin that was used as a basis for nsDialogs which is now part of the NSIS package?
Animaether
12th March 2009 17:43 UTC
it was created a long time before nsDialogs was created - I don't think it stood model for nsDialogs; I'd think that would be InstallOptions, just doing away with the .ini thing, but that's my guess :)