Make a text box mandatory
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
- Chris.Ediger
- Posts: 26
- Joined: Tue Oct 24, 2017 9:33 am
Make a text box mandatory
I would like to make a text box in my script mandatory. As in the "OK" button will not work unless the box has something in it.
- Alexander Riedel
- Posts: 7128
- Joined: Tue May 29, 2007 4:43 pm
- Chris.Ediger
- Posts: 26
- Joined: Tue Oct 24, 2017 9:33 am
Re: Make a text box mandatory
Can you maybe tell me where you moved this post?
- Alexander Riedel
- Posts: 7128
- Joined: Tue May 29, 2007 4:43 pm
Re: Make a text box mandatory
Right here where you answered it
In the PowerShell GUI forum.

Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: Make a text box mandatory
Here is a good place to start to learn how to validate a form based on its contents. There are a number of techniques described and some very good examples.
https://info.sapien.com/index.php/guis/gui-advanced-tips/validating-the-form
Since you are new to forms I recommend reading some of the other articles listed in the left menu. They will help you get up to speed with forms fairly quickly.
The simple answer to your question is to use the textbox "Validating" event to cancel the button event. The exact method of validation is a design choice which depends on the form design you are using.
https://info.sapien.com/index.php/guis/gui-advanced-tips/validating-the-form
Since you are new to forms I recommend reading some of the other articles listed in the left menu. They will help you get up to speed with forms fairly quickly.
The simple answer to your question is to use the textbox "Validating" event to cancel the button event. The exact method of validation is a design choice which depends on the form design you are using.