Hi,
I am using nsDialogs for making custom pages and i am stuck with one issue. I want to disable the next button if there is no value in the text. I have tried the solution suggested in other forum post but no success. below is my code.
Page Custom ServerChangesCreate ServerChangesLeave ""
Function ServerChangesCreate
nsDialogs::Create 1018
Pop $dialog
;Create a list box
${NSD_CreateLabel} 75 240 80 20 "Password"
${NSD_CreateText} 165 240 210 20 $R6
Pop $MPwd
${NSD_CreateLabel} 75 270 80 20 "MPort"
${NSD_CreateNumber} 165 270 210 20 $R7
Pop $MPort
${NSD_SetText} $MySQLPort 33307
${NSD_CreateLabel} 75 130 80 20 "Email"
${NSD_CreateText} 165 130 195 20 $R1
Pop $EmailField
nsDialogs::Show
FunctionEnd
Function ServerChangesLeave
${NSD_GetText} $MPort $R7
${Unless} ${TCPPortOpen} $R7
;MessageBox MB_OK "$R7 port is free"
${Else}
MessageBox MB_OK " Port $R7 is occupied by some other process, please specify a different port "
Abort
${EndIf}
${NSD_GetText} $MPwd $R6
${NSD_GetText} $EmailField $R1
FunctionEnd
So you can see i am using three different text field, in password field i want normal validation of the text.
In email field it should have a proper email, we can check with the help of @.
Please help me out as i am stuck with this.
how to Disable "Next" button in nsDialogs if text field has no value
6 posts
GetDlgItem $NextButton $HWNDPARENT 1 ; next=1, cancel=2, back=315
in that onchange function you can use NSD_GetText as you did before and hide/show the button as desiredGetDlgItem $NextButton $HWNDPARENT 1 ; next=1, cancel=2, back=315
${NSD_CreateText} 165 240 210 20 $R6
Pop $MPwd
${NSD_OnChange} $MPwd OnChange_MPwd
parsing for a valid email address should be possible using a combination WordFind and other headersFunction OnChange_MPwd
Pop $0
${NSD_GetText} $MPwd $0
${If} $0 == ""
EnableWindow $NextButton 0
${Else}
EnableWindow $NextButton 1
${EndIf}
FunctionEnd
Originally Posted by Yathosho View Postparsing for a valid email address should be possible using a combination WordFind and other headers
hi Yathosho thank you for quick reply, i made the changes suggested by you but it is still not disabling the field.
i don't know why it's not working for you. i've attached a working example, maybe it helps you to figure it out.
thank you very much Yathosho and Animaether for helping me. I got the mistake which i was doing. You guys rock.