Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wix Custom Dialog Validation

Tags:

validation

wix

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 null.

like image 932
Jonn Avatar asked Nov 10 '10 01:11

Jonn


1 Answers

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>
like image 106
Christopher Painter Avatar answered Nov 12 '22 03:11

Christopher Painter