Page 1 of 1 1
Topic Options
#44790 - 2003-09-04 04:48 PM Validate Input
@lejo @rias Offline
Starting to like KiXtart

Registered: 2003-09-02
Posts: 100
Loc: Medellin, Colombia
Hi, I need validate a Input from user,
in this code for example:

Color b+/n
Box (0,0,24,79,GRID) ; FONDO CUADRADO
Color b/n
Box (8,21,18,61,Ć) ; SOMBRA CAJA
Color g+/n
Box (7,20,17,60,FULL) ; CAJA VERDE
Color w+/n
At (10,22) "Código Sucursal Anterior: " Color r+ $SucAnt ; Mostrar mensajes solicitud codigos sucursales
Color w+/n
At (12,22) "Digite Código Sucursal Actual: "
Gets $SucAct
Color w+/n
At (14,22) "Código Asesor, ej, 50,51,52: "
Gets $CodAse

I need that $SucAct, be number and only have 3 characters.
_________________________
Look always 4 the best...

Top
#44791 - 2003-09-04 04:54 PM Re: Validate Input
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
code:
 do 
At (12,22) "Digite Código Sucursal Actual: "
Gets $SucAct
until val($SucAct) >= 100 and
val($SucAct) <= 999 and
len($SucAct) = 3

_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#44792 - 2003-09-04 04:57 PM Re: Validate Input
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Try this:
code:
Color b+/n
Box (0,0,24,79,GRID) ; FONDO CUADRADO
Color b/n
Box (8,21,18,61,Ć) ; SOMBRA CAJA
Color g+/n
Box (7,20,17,60,FULL) ; CAJA VERDE
Color w+/n
At (10,22) "Código Sucursal Anterior: " Color r+ $SucAnt ; Mostrar mensajes solicitud codigos sucursales
While Not $SucAct
Color w+/n
At (12,22) "Digite Código Sucursal Actual: " At(12,53)
Gets $SucAct
If Cstr(Val($SucAct))<>$SucAct OR Len(Val($SucAct))<>3
At(14,22) Color r+/n "Must be a 3 digit number!"
$SucAct=""
EndIf
Loop
Color w+/n
At (14,22) "Código Asesor, ej, 50,51,52: "
Gets $CodAse


Top
#44793 - 2003-09-04 05:08 PM Re: Validate Input
@lejo @rias Offline
Starting to like KiXtart

Registered: 2003-09-02
Posts: 100
Loc: Medellin, Colombia
Tks, it works...
_________________________
Look always 4 the best...

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.056 seconds in which 0.028 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org