Enable or disable the next button based on the current text management value in Wix?

I created a custom dialog page on wix and it has a text box. I want to disable the next installer button, if the text field is empty, enable it if the user typed a value. The following code works partially. It does not disable the next button, but does not go to the next page if you do not fill in this value. The problem is that the status of the next button is not updated when you enter a value in the edit text box. If I remove the value from the edit text box, and then return to the previous screen, and then the next button will be disabled.

<?xml version="1.0" encoding="UTF-8"?> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <Fragment> <UI> <Dialog Id="MyCustomDialog" Width="370" Height="270" Title="Custom Dialog Options"> <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="Next"> <Condition Action="disable">USERNAME1 = ""</Condition> <Condition Action="enable">NOT(USERNAME1 = "")</Condition> <Publish Event="NewDialog" Value="VerifyReadyDlg">NOT(USERNAME1 = "")</Publish> </Control> <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="Back"> <Publish Event="NewDialog" Value="CustomizeDlg">1</Publish> </Control> <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel"> <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish> </Control> <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="Please type the value" /> <Control Id="UserNameText" Type="Text" X="20" Y="60" Width="290" Height="13" NoPrefix="yes" Text="Please type the username" /> <Control Id="UserNameEdit" Type="Edit" X="20" Y="72" Width="290" Height="18" Multiline="no" Property="USERNAME1"/> </Dialog> </UI> </Fragment> </Wix> 
+7
user-interface controls condition wix
source share
2 answers

Disabling and enabling the Next button is virtually impossible on WIX. The answer from @ Wjdavis5 disabled the "Next" button for me, but the button will only be enabled if the user clicks on another text field. This is confusing.

The following code is based on this answer . It shows one text input window when the user clicks "Next", or he shows a dialog with an error, or goes to the installation screen.

 <Dialog Id="UserRegistrationDialog" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes"> <Control Id="UserIdEdit" Type="Edit" X="45" Y="85" Width="220" Height="18" Property="UserID" Text="{80}" /> <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="Next" > <Publish Event="NewDialog" Value="VerifyReadyDlg">2</Publish> <Publish Event="SpawnDialog" Value="UserIdError"><![CDATA[UserID = ""]]></Publish> </Control> </Dialog> <Dialog Id="UserIdError" Width="260" Height="85" NoMinimize="no" Title="[ProductName]"> <Control Id="UserIdErrorDesc" Type="Text" Width="194" Height="30" X="48" Y="15" Text="Please enter a User ID." /> <Control Id="UserIdErrorOk" Type="PushButton" X="97" Y="57" Width="56" Height="17" Text="Ok"> <Publish Event="EndDialog" Value="Return">1</Publish> </Control> </Dialog> 
+7
source share

Here is how I did it.

 <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="&amp;Next"> <Condition Action="enable"><![CDATA[InDBCONNECTION_STRING_VALID = "1"]]></Condition> <Condition Action="disable"><![CDATA[InDBCONNECTION_STRING_VALID = "0"]]></Condition> </Control> 
+3
source share

All Articles