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: 45
- Last visit: Tue May 09, 2023 8:35 pm
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: 8478
- Last visit: Tue Mar 26, 2024 8:52 am
- Been upvoted: 37 times
- Chris_Ediger
- Posts: 45
- Last visit: Tue May 09, 2023 8:35 pm
- Alexander Riedel
- Posts: 8478
- Last visit: Tue Mar 26, 2024 8:52 am
- Been upvoted: 37 times
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.