Sign in to follow this  
Followers 0
redfive19

Make input field mandatory & not matching

3 posts in this topic

#1 ·  Posted (edited)

Guys,

I want to make ALL input fields mandatory and leave a field blank. The tech field should NOT be equal to "<choose tech>". I also want msgbox's for when they don't choose a tech or makeI've tried everything I can think of. I even searched on this first.

Any ideas? Thanks in advance.

-redfive

#region --- GuiBuilder code Start ---
#Include <process.au3>
#Include <date.au3>
Dim $DATE
$DATE = _NowCalcDate()
$TIME = _NowTime()
$UID = StringLower(@Username)
$GINA = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "GinaDLL")

#include <GuiConstants.au3>

;~ If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000


$uid = StringLower(@username)
$mainwindow = GuiCreate("WINDOW", 295, 229,(@DesktopWidth-295)/2, (@DesktopHeight-229)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
;~ GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
$Input_1 = GuiCtrlCreateInput($uid, 70, 60, 190, 20)
$Input_2 = GuiCtrlCreateInput("", 70, 100, 190, 20, $ES_PASSWORD)
$Input_3 = GuiCtrlCreateInput(@LogonDomain, 70, 140, 190, 20)
$Label_4 = GuiCtrlCreateLabel("Username:", 10, 60, 50, 20)
$Label_5 = GuiCtrlCreateLabel("Password:", 10, 100, 60, 20)
$Label_6 = GuiCtrlCreateLabel("Domain:", 10, 140, 50, 20)
$okbutton = GuiCtrlCreateButton("OK", 60, 180, 70, 40)
GUICtrlSetState(-1, $GUI_DEFBUTTON)
;~ GUICtrlSetOnEvent($okbutton, "OKButton")
$cancelbutton = GuiCtrlCreateButton("Cancel", 160, 180, 70, 40)
;~ GUICtrlSetOnEvent($cancelbutton, "CancelClicked")
$Combo_9 = GuiCtrlCreateCombo("", 70, 30, 190, 21)
GUICtrlSetData(-1,"<choose tech>|Joey Smith|Joe Blow|Jeff Doe|Jose Sanchez", "<choose tech>")
$Label_10 = GuiCtrlCreateLabel("Tech", 10, 30, 40, 20)

GuiSetState()


While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $okbutton       
            GuiSetState(@SW_HIDE)
            ExitLoop
        Case $msg = $GUI_EVENT_CLOSE
            IniWrite("C:\WINDOWS\May 2005\may2005.ini", "USERINFO", "USERNAME", "CANCELLED")
            
            Exit
        Case $msg = $cancelbutton
            IniWrite("C:\WINDOWS\may2005.ini", "USERINFO", "TIME", $TIME)
            Exit
        EndSelect
        
    Wend


$tech = GUICtrlRead($Combo_9)
$password = GUICtrlRead($Input_2)
$userid = GUICtrlRead($Input_1)
Edited by redfive19

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

do your validation in the OK example:

Case $msg = $okbutton
    If(StringLen(GUICtrlRead($Input_2)) == 0) Then
        MsgBox(0,"Required","Password")
    Else
    ; do what you need to do
    EndIf

Edit: was in a hurry, relooked over code, validation should be in the ok

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

You rule, thank you much

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0