I'm using Rubik for my administration theme. If I submit a form without filling-in a required field, say at /node/add/story, Drupal will of course give an error message saying that the "Title field is required" and display the form again with the required fields outlined in red.

My problem is that the error message and the form with the outlined fields are not displayed in Rubik. They're displayed in the default front-end theme. The form looks totally whack in the front-end theme, so I need to fix this. I can't find any info on this. Any ideas?

Comments

jrstmartin’s picture

Nevamind. Solved with Ajax module. Gotta love Drupal - if ya can't fix it, there's always a workaround.

http://drupal.org/project/ajax

jrstmartin’s picture

Wow Ajax module causes more problems than it solves :/ Still looking for a solution to my original issue. The Drupal theme will not stay in Rubik upon submission error message. It switches to the front end theme to give the error message and looks horrible.

jrstmartin’s picture

Status: Active » Closed (fixed)

Found a fix to this highly annoying and unsightly problem. This is assuming you have an admin theme set and hence variable_get('admin_theme', 0);. You can also do $custom_theme = 'theme_name_here';

/**
* Implementation of hook_init().
*
* This forces the admin theme on node add/edit form validation errors.
* Needs to have a module weight of 0 to work (default). 
*/
function your_module_init() {
  global $custom_theme;

  if (arg(0) == 'node' && ((arg(1) == 'add') || (arg(2) == 'edit' ))) {
      $custom_theme = variable_get('admin_theme', 0);
      init_theme();
  }
}

Many thanks to subu.purohit for posting a fix.