开发者

Wix Custom Dialog Validation

开发者 https://www.devze.com 2023-01-24 02:27 出处:网络
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 validatio

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>
0

精彩评论

暂无评论...
验证码 换一张
取 消