CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Highlighting the background color of data entry field with error

Print topic Send  topic

Author Message
blankenb

Posts: 125
Posted: 06/26/2004, 10:54 AM

(Courtesy of Yes Support) When a field validation fails an error is displayed at the top of the form it would be nice if the background color of the problematic field could also be changed to make it easier for the form user to find the error field.


This can be done via custom template variables. When error occurrs for a given field you can use Error Theme class for its table cell, e.g. for Olive Theme it is
class="OliveErrorDataTD"

To implement it add template variable to <td> tag:
<td {error_class} class="OliveFieldCaptionTD">Project Id </td>

and in Before Show event of a form check the field error string. If it is not empty substitute template variable with a class definition:
global $Tpl;
if (strlen($form_name->field_name->Errors->ToString()))
$Tpl->SetVar("error_class","class=\"OliveErrorDataTD\"");
else
$Tpl->SetVar("error_class","");
View profile  Send private message
DonB
Posted: 06/26/2004, 7:12 PM

The way I do this might seem more understandable to you since it avoids
working with the template object directly:

In the grid (anywhere is fine), create a label named {error_class}. Now,
within the HTML panel, relocate the string {error_class} as shown in the
original example.

Now, all you have to do is set the label's Value property to
"class='OliveErrorDataTD'" or "class='OliveFieldCaptionTD'", depending on
whether there was an error or not.

This technique works for any special attributes you want to manipulate in
HTML tags, not just changing the Class. An interesting one would be links -
changing the "target=_blank", etc. - so you have the option of opening them
in new windows or the same window, even different panels of a frameset.

--
DonB

logging at http://www.gotodon.com/ccbth, and blogging at
http://ccbth.gotodon.net


"blankenb" <blankenb@forum.codecharge> wrote in message
news:540ddb86b79a48@news.codecharge.com...
> (Courtesy of Yes Support) When a field validation fails an error is
displayed
> at the top of the form it would be nice if the background color of the
> problematic field could also be changed to make it easier for the form
user to
> find the error field.
>
>
> This can be done via custom template variables. When error occurrs for a
given
> field you can use Error Theme class for its table cell, e.g. for Olive
Theme it
> is
> class="OliveErrorDataTD"
>
> To implement it add template variable to <td> tag:
> <td {error_class} class="OliveFieldCaptionTD">Project Id </td>
>
> and in Before Show event of a form check the field error string. If it is
not
> empty substitute template variable with a class definition:
> global $Tpl;
> if (strlen($form_name->field_name->Errors->ToString()))
> $Tpl->SetVar("error_class","class=\"OliveErrorDataTD\"");
> else
> $Tpl->SetVar("error_class","");
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>


Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.