hi,
i want to input only integer in my field.if without integer any
input put in the field it will show warning messege.
such as "12 "will be accept
but "12sds" will not accept .
"fhe34" will not accept
plz help me by any javascript code.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: input field validation
am 11.05.2008 17:02:51 von Yves Sucaet
Allow me to point out that this is not database-related...
This website should get you everything you want:
http://www.acmesoffware.com/acme/ExamplesJS/jsExm_ValidateIn teger.asp
HTH,
Yves
----- Original Message -----
From: "arafat uddin"
To:
Sent: Sunday, May 11, 2008 12:48 AM
Subject: [PHP-DB] input field validation
> hi,
> i want to input only integer in my field.if without integer any
> input put in the field it will show warning messege.
> such as "12 "will be accept
> but "12sds" will not accept .
> "fhe34" will not accept
>
>
> plz help me by any javascript code.
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Thiago Henrique Pojda
Desenvolvimento Web
+55 41 3033-7676
thiago.pojda@softpartech.com.br
Excel=EAncia em Softwares Financeiros
-----Mensagem original-----
De: sahabettin akca [mailto:adminsaho@gmail.com]=20
Enviada em: domingo, 11 de maio de 2008 14:31
Para: php-db@lists.php.net
Assunto: Re: [PHP-DB] input field validation
hi,
*javascript function :
function isNumber(obj) {
var len =3D obj.value.length;
var lastChar =3D obj.value.charAt(len-1);
if( lastChar !=3D '0' && lastChar !=3D '1' && lastChar !=3D '2' &&
lastChar
!=3D '3' && lastChar !=3D '4' &&
do not alert , but add alert
----
* obj.value =3D obj.value.substring(0, len-1);
---
this line before
---
alert('this field only integer!');
*
----
add.
good luck
?ahabettin akca (saho)
2008/5/11 arafat uddin :
-------------------------
and
this database field data type select int (integer) ,
tinyint, int, bigint... or
if(gettype($_POST['field'])!=3D"integer") // or =
if(intval($_POST['field'])==0)
or if(!intval($_POST['field']))
{
print"not integer";
location("header: xxxx.php");
#or
print"";
}
else
{
.....
}
2008/5/11 Yves Sucaet :
> Allow me to point out that this is not database-related...
>
> This website should get you everything you want:
> http://www.acmesoffware.com/acme/ExamplesJS/jsExm_ValidateIn teger.asp
>
> HTH,
>
> Yves
>
> ----- Original Message ----- From: "arafat uddin" =
> To:
> Sent: Sunday, May 11, 2008 12:48 AM
> Subject: [PHP-DB] input field validation
>
>
>
> hi,
> > i want to input only integer in my field.if without integer any
> > input put in the field it will show warning messege.
> > such as "12 "will be accept
> > but "12sds" will not accept .
> > "fhe34" will not accept
> >
> >
> > plz help me by any javascript code.
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--=20
?ahabettin akca // saho
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: RES: input field validation
am 12.05.2008 18:47:38 von Yves Sucaet
Nope, it's not. The problem was formulated as "Integer" detection. not
numerical detection in general. isNaN will return positive for e.g. float=
ing
point values as well. The solutions described in this thread all result i=
n
integer-only values.
All solutions presented are still off-topic, of course...
Yves
------ Original Message ------
Received: Mon, 12 May 2008 11:12:02 AM CDT
From: "Thiago Pojda"
To: "'sahabettin akca'" ,
Subject: RES: [PHP-DB] input field validation
It'd be simpler to use isNaN()
Thiago Henrique Pojda
Desenvolvimento Web
+55 41 3033-7676
thiago.pojda@softpartech.com.br
Excel=EAncia em Softwares Financeiros
-----Mensagem original-----
De: sahabettin akca [mailto:adminsaho@gmail.com] =
Enviada em: domingo, 11 de maio de 2008 14:31
Para: php-db@lists.php.net
Assunto: Re: [PHP-DB] input field validation
hi,
*javascript function :
function isNumber(obj) {
var len =3D obj.value.length;
var lastChar =3D obj.value.charAt(len-1);
if( lastChar !=3D '0' && lastChar !=3D '1' && lastChar !=3D '2' &&
lastChar
!=3D '3' && lastChar !=3D '4' &&
do not alert , but add alert
----
* obj.value =3D obj.value.substring(0, len-1);
---
this line before
---
alert('this field only integer!');
*
----
add.
good luck
?ahabettin akca (saho)
2008/5/11 arafat uddin :
-------------------------
and
this database field data type select int (integer) ,
tinyint, int, bigint... or
if(gettype($_POST['field'])!=3D"integer") // or if(intval($_POST['field']=
)==0)
or if(!intval($_POST['field']))
{
print"not integer";
location("header: xxxx.php");
#or
print"";
}
else
{
..
}
2008/5/11 Yves Sucaet :
> Allow me to point out that this is not database-related...
>
> This website should get you everything you want:
> http://www.acmesoffware.com/acme/ExamplesJS/jsExm_ValidateIn teger.asp
>
> HTH,
>
> Yves
>
> ----- Original Message ----- From: "arafat uddin"
>
> To:
> Sent: Sunday, May 11, 2008 12:48 AM
> Subject: [PHP-DB] input field validation
>
>
>
> hi,
> > i want to input only integer in my field.if without integer any
> > input put in the field it will show warning messege.
> > such as "12 "will be accept
> > but "12sds" will not accept .
> > "fhe34" will not accept
> >
> >
> > plz help me by any javascript code.
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
-- =
?ahabettin akca // saho
-- =
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php