Re: [PHPLIB] textarea validation /oohforms From: Shawn Patton (shawn <email protected>)
Date: 11/10/99

Alan,

I believe a server side implementation has been posted in the archives.
Here is some javascript for the client side. The basic premise with
oohforms and client side javascript is you may add virtually any javascript
you wish to your form as arguments to the finish($after,$before) object method.

So I'll add the following javascript as the $after argument:

<?php
$after = "for (var i = 0; i < f.elements.length; i++) {
   for (var i = 0; i < f.elements.length; i++) {
      my_el_name = f.elements[i].name
      el_type = f.elements[i].type
      if (el_type == 'textarea'){
         if (f.elements[i].value == 0){
            alert (f.elements[i].value)
            alert(\"Please enter information in \" + my_el_name)
            f.elements[i].focus();
            return(false)
            break
          }
       }
    }
}
";

$f->finish($after);
?>

Check out sample javascript at: http://www.irt.org/

-Shawn Patton

Alan Lee wrote:

> Anyone have a short and sweet way to make sure that users filled
> something in a textarea?
>
> A
> -
> PHP3 Base Library Mailing List. Send messages to <phplib <email protected>>.
> To unsubscribe, send "unsubscribe" to <phplib-request <email protected>> in
> the body, not the subject, of your message.

-
PHP3 Base Library Mailing List. Send messages to <phplib <email protected>>.
To unsubscribe, send "unsubscribe" to <phplib-request <email protected>> in
the body, not the subject, of your message.