Je souhaiterais mettre en place un dispositif de validation des champs
exemple:
le champ nom n'est pas validé forcer l'utilisateur à remplir le champ
le champ email est aml formé forcer l'utilisateur à le modifier
le champ tel est mal formé forcer l'utilisateur à le modifier
Pourriez vous svp m'indiquer quelle serait la meilleure manière de procéder
en vous remerciant pour vos conseils
Jean-Marc
Code : Tout sélectionner
[spoiler=]Example()
Func Example()
local $BS_ICON
; Create a GUI with various controls.
Local $hGUI = GUICreate("Création Signature Outlook")
Local $label_nom = GUICtrlCreateLabel("Nom", 10, 30, 85, 25)
Local $input_nom = GUICtrlCreateInput("", 100, 30, 300, 30)
Local $label_prenom = GUICtrlCreateLabel("Prenom", 10, 55, 85, 30)
Local $input_prenom = GUICtrlCreateInput("", 100, 50, 300, 30)
Local $label_service = GUICtrlCreateLabel("Service", 10, 75, 85, 30)
Local $input_service = GUICtrlCreateInput("", 100, 75, 300, 20)
Local $label_fonction = GUICtrlCreateLabel("Fonction", 10, 95, 85, 30)
Local $input_fonction = GUICtrlCreateInput("", 100, 95, 300, 20)
Local $label_TelFixe = GUICtrlCreateLabel("Tél Fixe", 10, 105, 85, 30)
Local $input_TelFixe = GUICtrlCreateInput("", 100, 105, 300, 20)
Local $label_Mobile = GUICtrlCreateLabel("Tél Mobile", 10, 125, 85, 30)
Local $input_Mobile = GUICtrlCreateInput("", 100, 125, 300, 20)
Local $lable_Email = GUICtrlCreateLabel("Adresse Email", 10, 145, 85, 30)
Local $input_Email = GUICtrlCreateInput("", 100, 145, 300, 30)
Local $check_Adresse_ARS = GUICtrlCreateCheckbox("Ajouter adresse ", 10, 165, 85, 30)
Local $check_Adresse_Campagne = GUICtrlCreateCheckbox("Ajouter campagne ", 10, 165, 85, 30)
Local $idOK = GUICtrlCreateButton("OK", 310, 370, 85, 25,$BS_ICON)
local $image = GUICtrlCreatePic("signature.png", 10, 310, 300, 300)
; Display the GUI.
GUISetState(@SW_SHOW, $hGUI)
; Loop until the user exits.
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $idOK
case $input_nom = ""
msgbox(64, "Champ nom vide", "Attention vous n'avez pas remplit le champ nom")
case $input_prenom =""
msgbox(64, "Champ nom vide", "Attention vous n'avez pas remplit le champ prenom")
case $input_service =""
msgbox(64, "Champ nom vide", "Attention vous n'avez pas remplit le champ service")
local $tableau[0]
_ArrayAdd($tableau, GUICtrlRead($input_nom))
_ArrayAdd($tableau, GUICtrlRead($input_prenom))
_ArrayAdd($tableau, GUICtrlRead($input_service))
_ArrayAdd($tableau, GUICtrlRead($input_fonction))
_ArrayToClip($tableau)
_ArrayDisplay($tableau)
MsgBox($MB_SYSTEMMODAL, "Valeurs saisies ", GUICtrlRead($input_nom) & " " & GUICtrlRead($input_prenom) & @CRLF & " Pôle :" & GUICtrlRead($input_service) & @CRLF & GUICtrlRead($input_fonction))
MsgBox($MB_SYSTEMMODAL, "Récapitulatif", ClipGet())
MsgBox($MB_SYSTEMMODAL, "Chaine tableau", _ArrayToString($tableau, "-", 1, 3))
ExitLoop
EndSwitch
WEnd
EndFunc ;==>Example
[/spoiler]


