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
Steven, You can have a look at http://drupal.org/project/clientside_validation (disclaimer: build by us), it adds javascript validation to all forms using the jquery.validate plugin, this plugin allows you to position the error messages inline, but this option isn't currently supported, but it can't be that hard to add ;p Best regards, Peter Droogmans Attiks Ketsstraat 94 2140 Borgerhout Belgium 32 3 288 61 17 32 497 44 44 77 -----Original Message----- From: development-bounces@drupal.org [mailto:development-bounces@drupal.org] On Behalf Of Steven Jones Sent: donderdag 26 mei 2011 12:18 PM To: development Subject: [development] Inline form errors 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
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?
http://drupal.org/project/ife was literally made for you. Cheers, Greg -- Greg Knaddison | 720-310-5623 | http://growingventuresolutions.com http://masteringdrupal.com - Videos and Tutorials
http://drupal.org/project/ife was literally made for you.
Brilliant, thank you very much indeed. Regards Steven Jones ComputerMinds ltd - Perfect Drupal Websites Phone : 024 7666 7277 Mobile : 07702 131 576 Twitter : darthsteven http://www.computerminds.co.uk On 26 May 2011 12:46, Greg Knaddison <greg@growingventuresolutions.com> wrote:
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?
http://drupal.org/project/ife was literally made for you.
Cheers, Greg
-- Greg Knaddison | 720-310-5623 | http://growingventuresolutions.com http://masteringdrupal.com - Videos and Tutorials
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 < steven.jones@computerminds.co.uk> 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 randy@randyfay.com +1 970.462.7450
participants (4)
-
Greg Knaddison -
Peter Droogmans -
Randy Fay -
Steven Jones