Hello,
I am trying to have a element level validation update the value of that element in an attempt to correct to what the user might have meant but cannot get the field to be updated. I also want it to throw an error and alert the user, not just update and keep going. The code that should be relevant is below. I can provide more if necessary. Any help would be appreciated.
validator code block (simplified)
function rm_...._validate($element, &$form_state) {
....
form_set_error('ipaddress','Did you mean "' . $matches[0] . '"? Please verify and resubmit the form.');
form_set_value($element, 0, $form_state);
....
return $element;
}
form item
$form['core']['field'] = array(
'#type' => 'textfield',
'#input' => TRUE,
'#title' => t('Title'),
'#required' => FALSE,
'#default_value' => $node->value,
'#maxlength' => 15,
'#weight' => 1,
'#element_validate' => array('rm_....._validate'),
);
Comments
Comment #1
dddave commentedThere is an extra forum for module development...
Comment #2
kars-t commentedHi
I am closing this issue to clean up the issue queue. Feel free to reopen the issue if there is new information and the problem still resides. If not please make sure you close your issues that you don't need any more.
Maybe you can get support from the local user group. Please take a look at this list at groups.drupal.org.