/ Published in: PHP
                    
                                        
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
function yourmodulename_form_alter(&$form, $form_state, $form_id) {
if($form_id == 'thisformid'){
$form['field']['#prefix'] = 'This text gets overwritten by the after build';
$form['#after_build'][] = 'yourmodulename_after_build'; //Calls function
//drupal_add_css('hello.css'); This line does not work when validation fails
}
}
function yourmodulename_after_build($form, &$form_state) {
$form['field']['#prefix'] = 'This text will rule them all!';
drupal_add_css('hello.css'); //This line works even after validation fails.
return $form;
}
Comments
 Subscribe to comments
                    Subscribe to comments
                
                