Skip to content
⌘ NSIS Forum Archive

custom page and validate the input

4 posts

carleton#

custom page and validate the input

I am working on developing a custom page that needs to validate the input before continuing. I have read the OptionInstall2 page a number of times now and simply do not understand how to get the validation function called. Here is what I have:

Here is my init:

Function .onInit
!insertmacro MUI_INSTALLOPTIONS_EXTRACT_AS "assets\RegForm.ini" "RegForm"
FunctionEnd
This is where I am calling the page:

!insertmacro MUI_PAGE_LICENSE "..\licence\Licence.txt"

LangString REGFORM_TITLE ${LANG_ENGLISH} "Registration."
LangString REGFORM_SUBTITLE ${LANG_ENGLISH} "Enter your Unlock Key."
Page custom RegPageShow

!insertmacro MUI_PAGE_DIRECTORY
The function calls:

Function RegPageShow

!insertmacro MUI_HEADER_TEXT "$(REGFORM_TITLE)" "$(REGFORM_SUBTITLE)"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "RegForm"

FunctionEnd

Function RegPageValidate

ReadINIStr $R0 "RegistrationForm" "Field 4" "State"
StrCmp $R0 "" 0 +3
MessageBox MB_ICONEXCLAMATION|MB_OK "Please enter your name."
Abort

FunctionEnd
Joel#
I see your function called RegPageValidate, but when is it executed?
Try move the contents of RegPageValidate into RegPageShow...
demiller9#
put the validation function on the custom page definition
Page custom RegPageShow RegPageValidate
Don
carleton#
Originally posted by demiller9
put the validation function on the custom page definition
Thank you! I did keep digging through the documentation last night and finally found the answer, I am still a bit new to working with Open Source project's, man what a different mindset. The answer is there, you just have to dig for it at times!