Wix Custom Dialog Validation
How can you validate fields in a Wix Custom Dialog? I've got a combo box that I'm using to set a property that cannot be n开发者_开发百科ull.
It's going to depend on the complexity of your validation. For a simple one control must have a value you could do something like:
<UI...>
<Dialog...>
<Control Id="Next"...>
<Publish Event="SpawnDialog" Value="ErrorsDlg">Not SomeProperty</Publish>
<Publish Event="NewDialog" Value="NextDialog">Property</Publish>
</Control>
</Dialog>
</UI>
Where ErrorsDlg is a Dialog that you create to resemble a MessageBox style dialog. If you have more complicated validation you can write a custom action that reads properties, evaluates rules and sets a flag along with an error message to be displayed. That would look more like this:
<UI...>
<Dialog...>
<Control Id="Next"...>
<Publish Event="DoAction" Value="ValidateCA">1</Publish>
<Publish Event="SpawnDialog" Value="ErrorsDlg">Not DataValid</Publish>
<Publish Event="NewDialog" Value="NextDialog">DataValid</Publish>
</Control>
</Dialog>
</UI>
精彩评论