I am adding some custom fields to a registration page using the field UI module. I'm also using the clientside validation module to display error messages on required fields. I am able to change the error messages for the default fields I have not added using the field UI, but not for the fields added with the field UI. I have tried many different ways of targeting the fields to no avail. I'm using Drupal 7.
I can see the custom rule is actually being set when I
<span data-thmr='thmr_13' class='devel-themer-wrapper'>Please enter your first name.</span
...but the default error message still shows. I have a feeling this is due to the
<input> element's name attribute being
field_first_name[und][value], but I was even unsuccessful in targeting this rule using that string in the
The difference between the default fields and my custom fileds are the custom fields values are very heavily nested within multiple arrays.
However, I'm unsuccessful in changing the input element's name attribute using any of the following:
$form['field_first_name'][#name], $form['field_first_name'][#field_name], $form['field_first_name']['und']['value'][#field_name], $form['field_first_name'][#name], etc.
My custom rules:
_clientside_validation_set_required( $element['#name'], $element['#title'], isset($element['#required']) ? $element['#required'] : FALSE, $js_rules, t('Please enter your company email.') );
Which works for the drupal default email field. However, this (or any of the many ways I've tried referencing the element's name) does not change the error message for my custom "first name" field:
_clientside_validation_set_required( $element['#field_name'], $element['#title'], isset($element['#required']) ? $element['#required'] : FALSE, $js_rules, t('Please enter your first name.') );
It turns out it IS the name attribute. When I hard code the name as
theme_textfield(), my custom error message shows up. The problem with this is it prevents the proper values from being written to the database. Is there a way to escape the brackets in
field_first_name[und][value] in order to use that as the first argument of