Another way is to refresh the page everytime the user has filled a field in
and moves to another:

<FORM name="myform">
<INPUT type ="text" name="field1" value=""
onchange="javascript:submit_field( 1 )">
<INPUT type="hidden" name="field_to_check" value="">

 <SCRIPT language="JavaScript">
  function submit_field( i ) {
       document.myform.field_to_check.value = "field" + i  ;
        document.myform.submit() ;
 }
 </SCRIPT>

The idea is that the "onchange" event is triggered when the user has input
something and moves her mouse cursor somewhere else in the form.
The javascript passes to the server the name of the field that is to be
checked server-side. Supposes you have a consistent naming convention for
fields, but you can easily adapt the js function ...

Still, Rodrigo's idea of server-side checking every field one at a time does
not seem much user-friendly to me. Better normally validate all POST-ed
fields server-side upon form submit.


----- Original Message -----
From: "Cal Evans" <[EMAIL PROTECTED]>
To: "Rodrigo" <[EMAIL PROTECTED]>; "PHP" <[EMAIL PROTECTED]>
Sent: Thursday, September 05, 2002 2:58 PM
Subject: RE: [PHP-DB] Form question.......


> That's a toughie.  I've done it once where I used a small popup window
> (opening it with JavaScript) to go to the server, perform the query to
> retrieve the information, stuff it into a JavaScript array and then return
> the array to the calling page and close the window.
>
> It works but the user will see a small window pop-up.
>
> Other than that, it is possible to use a Java Applet to do it as well.
>
> HTH,
> =C=
>
> *
> * Cal Evans
> * The Virtual CIO
> * http://www.calevans.com
> *
>
>
> -----Original Message-----
> From: Rodrigo [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, September 04, 2002 7:30 PM
> To: PHP
> Subject: [PHP-DB] Form question.......
>
>
> Hi, i have a question, it may be dumb, but im very new with php and
mysql,
> i need help.
>
>  how can i check a form when i change from one field to another???? I want
> make a condition.....if the number i typed is allready in the database,
not
> just when i finish filling out the hole form...clickin in submit and then
> make the conditions....help !!!! heheheh
>
>
>
> --------------------------------------------------------------------------
--
> ----
>          Rodrigo Corra
>          [EMAIL PROTECTED]
>
>
>
>       Obs: Sorry about the english, im from Brazil...so my english isnt
> good
>
>
>
> --
> 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

Reply via email to