views:

40

answers:

2

I need my installer to accept a password, and so I've created a dialog on which users are prompted to enter their passwords twice (to avoid mistakes), however I'm having some trouble getting my "Your passwords don't match" label to appear and disappear at the correct times.

This is what I have so far:

<Control Id="Password" Type="Edit" Property="VDIR_PASSWORD" Password="yes" />
<Control Id="ConfirmPassword" Type="Edit" Property="ConfirmPassword" Password="yes" />
<Control Id="PasswordMismatchLabel" Type="Text" Text="Passwords do not match.">
  <Condition Action="hide">VDIR_PASSWORD = ConfirmPassword</Condition>
</Control>

This compiles, however does the label never shows. (if I reverse the condition then the label shows, but doesn't disappear if they don't match).

I can see that the thing I'm missing is subscription to some event that updates the label whenever something happens (e.g. the user presses a key, or focus is lost from either of the controls), however I'm not able to find any documentation or examples of how I might achieve this.

Is it possible to do this?

+1  A: 

As far as I'm aware, there is no event subscription model in Wix. What you'll likely have to do is create a custom action to verify that the passwords match and have that control the label. This may help also.

Justin Pinkley
+1  A: 

WiX can only do what underlying technology (Windows Installer) can. Windows Installer has poor UI comparing to usual desktop applications we all used to. So, answering your question: no, you can't show/hide the label based on the value you've typed into the password field. At least, I'm not aware about a supported way.

However, you can do the following. Drop that label, and instead add a condition to the Next button of this dialog. If passwords match, move to the next dialog in the chain. Otherwise, show a message box saying "password don't match" and stay on the current dialog until the user fills it in correctly.

Hope this helps.

Yan Sklyarenko