PHP Classes

forms.php - InvalidCLASS && CLASS

Recommend this page to a friend!

      PHP Forms Class with HTML Generator and JavaScript Validation  >  PHP Forms Class with HTML Generator and JavaScript Validation package blog  >  How to Show Google Ma...  >  All threads  >  forms.php - InvalidCLASS && CLASS  >  (Un) Subscribe thread alerts  
Subject:forms.php - InvalidCLASS && CLASS
Summary:allowing CLASS and InvalidCLASS stay side by side
Messages:3
Author:Ludwig Ruderstaller
Date:2007-11-12 11:17:33
Update:2007-11-13 09:46:19
 

  1. forms.php - InvalidCLASS && CLASS   Reply   Report abuse  
Picture of Ludwig Ruderstaller Ludwig Ruderstaller - 2007-11-12 11:17:33
Hi,

Little Change to OutputStyleAttributes() so you can have a CLASS and InvalidCLASS side by side.

eg.
normal textfield:
<input type="text" [...] class="foobar">
if field is marked as invalid it overwrites the CLASS definition.

HTML allows multiple class notation so the expected result would be something like:
<input type="text" [...] class="foobar invalid">

I changed the code to this (Line 1799):

if($invalid
&& IsSet($input["CLASS"])
&& IsSet($input["InvalidCLASS"])){
$class=$input["CLASS"]." ".$input["InvalidClass"];
}elseif($invalid
&& IsSet($input["CLASS"])
&& strlen($this->InvalidCLASS)){
$class=$input["CLASS"]." ".$this->InvalidCLASS;
}elseif($invalid
&& IsSet($input["InvalidCLASS"]))
$class=$input["InvalidCLASS"];
elseif($invalid
&& strlen($this->InvalidCLASS))
$class= $this->InvalidCLASS;
elseif(IsSet($input["CLASS"]))
$class=$input["CLASS"];
else
$class="";

greetings
Ludwig

  2. Re: forms.php - InvalidCLASS && CLASS   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2007-11-13 02:01:34 - In reply to message 1 from Ludwig Ruderstaller
Thank you for your suggestion but I cannot apply your patch because it would break backwords compatibility of existing applications.

To achieve what you want you can set InvalidCLASS to the names of all CSS classes you want to use..

  3. Re: forms.php - InvalidCLASS && CLASS   Reply   Report abuse  
Picture of Ludwig Ruderstaller Ludwig Ruderstaller - 2007-11-13 09:46:23 - In reply to message 2 from Manuel Lemos
Hi,

no problem at all, i have your formgen in my subversion and if you update your class my "patch" will be applyied in my version of formgen.

tia
Ludwig