There are two things that come to mind immediately, but I think there are other approaches as well.
1. AJAX-enabled form elements put the errors by default right with the element. This is often good. You can also put them anywhere with a little fiddling. 2. Using hook_page_alter() you can change the location of the dsm messages (D7). That's easy and might be an appropriate approach. I imagine a simple change to page.tpl.php would also allow you to put your messages in a more appropriate place. I really think this is a #fail in Drupal, as it's a very common problem. Users often miss error messages because they show up out of context. I'd certainly welcome a D8 fix for this. -Randy On Thu, May 26, 2011 at 4:18 AM, Steven Jones < [email protected]> wrote: > Hello developers, > > We're building a site that has a form in a block in one of our > sidebars. If the user enters incorrect values, the form validation > happens correctly, and errors are flagged up. However the messages > such as: > > 'The title field is required' > > Appear in the main messages region, at the top of the page content, > which is nowhere near our form on the page, which is in a sidebar. The > fields in the form are highlighted, so the user can see that something > is wrong with the input, but the messages are a mile away. > > Is there any module or method for getting the validation messages for > the current form in the location of the form itself, and out of the > global messages? Or any effort to get something like this into core? > I'm happy to code something if I need to, just wondered if anyone had > tackled this before? > > Regards > Steven Jones > ComputerMinds ltd - Perfect Drupal Websites > > Phone : 024 7666 7277 > Mobile : 07702 131 576 > Twitter : darthsteven > http://www.computerminds.co.uk > -- Randy Fay Drupal Module and Site Development [email protected] +1 970.462.7450
