Fields that fail validation are not highlighted.

loze - September 28, 2008 - 17:16
Project:Validation API
Version:6.x-1.0-rc2
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

fields that fail validation are not highlighted with the error class. The corrcet validation message appears above the form, but there is no indication on that field, as there is with the default drupal validation.

related to that, when using AJAX validation, no message is displayed next to the field.
I'm assuming the correct field id is not being passed somewhere.

#1

loze - September 28, 2008 - 19:42
Status:active» needs review

i think this is related to multiple values settings in cck and how the form element is referenced.

changing line 545 in validation_api.module
from
form_set_error($element['#name'], t($message, $substitutes));
to
form_set_error($element['#field_name'], t($message, $substitutes));

fixes this for me, however i do not know how this could effect the modules normal operation.

#2

TapocoL - September 30, 2008 - 17:48

So, I have been reviewing this. And, I have ran into a problem with setting a specific element in an FAPI tree to have an error. #field_name will highlight all fields in a tree with an error, whereas FAPI is not reading the #name like I thought it would to determine which field to highlight on errors. So, I will be looking through some of the current CCK validation modules to see what they are doing here in a day or two.

#3

TapocoL - September 30, 2008 - 17:48
Status:needs review» needs work

#4

TapocoL - October 2, 2008 - 20:58
Status:needs work» fixed

Alright, was able to fix this for CCK fields and regular fields. Both fields had problems while in trees of an FAPI. RC3 will be up momentarily with the fix.

#5

Anonymous (not verified) - October 16, 2008 - 21:03
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

#6

bpolgar - April 1, 2009 - 01:51
Status:closed» active

Hi,
for most of the invalid fields highlighting works, but
i. not for date field (in my form I have only a From date),
ii. for a text select list the color of the font was changed to red and not the border of the field.

#7

ccshannon - May 22, 2009 - 03:42

I have a validation against the 'promote' checkbox field on certain node types and it does not get highlighted when failing validation.

#8

frankcarey - June 10, 2009 - 21:40

same thing here, my cck date type isn't highlighted.

 
 

Drupal is a registered trademark of Dries Buytaert.