views:

136

answers:

1

I'm trying to display a page in NSIS to obtain two different values. I want both to be not empty. The page actually displays altough I can't get my page leave function to check properly for empty fields.

Function CCInstallOpts
  ReserveFile "cc_installopt.ini"
  !insertmacro MUI_INSTALLOPTIONS_EXTRACT "cc_installopt.ini"
  !insertmacro MUI_INSTALLOPTIONS_DISPLAY "cc_installopt.ini"    
FunctionEnd

My page leave function where I validate fields (4 and 5 ) is :

Function CCInstallOptsLeave

    Push $R0
    Push $R1

    !insertmacro MUI_INSTALLOPTIONS_READ $R0 "cc_installopt.ini" "Field4" "State"
    !insertmacro MUI_INSTALLOPTIONS_READ $R1 "cc_installopt.ini" "Field5" "State"
    StrCmp $R0 "" mustcomplete
    StrCmp $R1 "" mustcomplete
    StrCpy $CC_CyberID $R0
    StrCpy $CC_VCode   $R1

    goto exitfunc

mustcomplete:

     MessageBox MB_OK|MB_ICONEXCLAMATION "Empty not allowed"
     Abort

exitfunc:

     Pop $R1
     Pop $R0

FunctionEnd

Note that I want to store the entered values into $CC_VCode and $CC_CyberID variables to be later used on different files (I've defined both as:)

Var /GLOBAL CC_VCode
Var /GLOBAL CC_CyberID

Thanks in advance.

+1  A: 

You are missing a space in the field name

!insertmacro MUI_INSTALLOPTIONS_READ $R0 "cc_installopt.ini" "Field 4" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $R1 "cc_installopt.ini" "Field 5" "State"
Anders
Thanks, that worked.!
Hernán