Craps out on Form errors (HIGH PRIORITY)

jrbrown1977@gma... - October 25, 2009 - 19:34
Project:AHAH helper
Version:6.x-6.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:active
Description

Get the following error on the demo form and my own form with the following steps.

1. Select a form element that does AHAH generation.
2. Click submit without filling in required fields
3. Error message is displayed stating what is missing, then click submit again.
4. You get a screen with the below message only.

{ "status": true, "data": "\x3cdiv class=\"messages error\"\x3e\n \x3cul\x3e\n \x3cli\x3eFirst name field is required.\x3c/li\x3e\n \x3cli\x3eLast name field is required.\x3c/li\x3e\n \x3cli\x3eAddress field is required.\x3c/li\x3e\n \x3c/ul\x3e\n\x3c/div\x3e\n\x3cdiv id=\"billing-info-wrapper\"\x3e\x3cfieldset\x3e\x3clegend\x3eBilling information\x3c/legend\x3e\x3cdiv class=\"form-item\" id=\"edit-billing-info-usage-wrapper\"\x3e\n \x3clabel for=\"edit-billing-info-usage\"\x3eUsage: \x3c/label\x3e\n \x3cselect name=\"billing_info[usage]\" class=\"form-select\" id=\"edit-billing-info-usage\" \x3e\x3coption value=\"private\" selected=\"selected\"\x3ePrivate\x3c/option\x3e\x3coption value=\"company\"\x3eCompany\x3c/option\x3e\x3c/select\x3e\n\x3c/div\x3e\n\x3cinput type=\"submit\" name=\"op\" id=\"edit-billing-info-update-usage\" value=\"Update usage\" class=\"form-submit no-js\" /\x3e\n\x3cdiv class=\"form-item\" id=\"edit-billing-info-first-name-wrapper\"\x3e\n \x3clabel for=\"edit-billing-info-first-name\"\x3eFirst name: \x3cspan class=\"form-required\" title=\"This field is required.\"\x3e*\x3c/span\x3e\x3c/label\x3e\n \x3cinput type=\"text\" maxlength=\"255\" name=\"billing_info[first_name]\" id=\"edit-billing-info-first-name\" size=\"20\" value=\"\" class=\"form-text required error\" /\x3e\n\x3c/div\x3e\n\x3cdiv class=\"form-item\" id=\"edit-billing-info-last-name-wrapper\"\x3e\n \x3clabel for=\"edit-billing-info-last-name\"\x3eLast name: \x3cspan class=\"form-required\" title=\"This field is required.\"\x3e*\x3c/span\x3e\x3c/label\x3e\n \x3cinput type=\"text\" maxlength=\"255\" name=\"billing_info[last_name]\" id=\"edit-billing-info-last-name\" size=\"20\" value=\"\" class=\"form-text required error\" /\x3e\n\x3c/div\x3e\n\x3cdiv class=\"form-item\" id=\"edit-billing-info-address-wrapper\"\x3e\n \x3clabel for=\"edit-billing-info-address\"\x3eAddress: \x3cspan class=\"form-required\" title=\"This field is required.\"\x3e*\x3c/span\x3e\x3c/label\x3e\n \x3cinput type=\"text\" maxlength=\"255\" name=\"billing_info[address]\" id=\"edit-billing-info-address\" size=\"20\" value=\"\" class=\"form-text required error\" /\x3e\n\x3c/div\x3e\n\x3cdiv class=\"form-item\" id=\"edit-billing-info-country-wrapper\"\x3e\n \x3clabel for=\"edit-billing-info-country\"\x3eCountry: \x3c/label\x3e\n \x3cinput type=\"text\" maxlength=\"255\" name=\"billing_info[country]\" id=\"edit-billing-info-country\" size=\"20\" value=\"\" class=\"form-text\" /\x3e\n\x3c/div\x3e\n\x3c/fieldset\x3e\n\x3c/div\x3e", "settings": { "ahah": { "edit-billing-info-usage": { "url": "/~jbrown/20ci/?q=ahah_helper/billing_info", "event": "change", "keypress": null, "wrapper": "billing-info-wrapper", "selector": "#edit-billing-info-usage", "effect": "none", "method": "replace", "progress": { "type": "throbber" }, "button": false } } } }

#1

lurkerfilms - November 25, 2009 - 16:42

I've seen this type of response as well in that exact situation.

You may want to check if your submit buttons use drupal_get_destination() to build the submit url. If so you will get the wrong destination url if a ahah event happened before the submit. I was getting exactly this type of error until I got rid of the call to drupal_get_destination().

Easy to check. After the ahah call check what url gets generated for the form submit.

Good luck hope that helps.

 
 

Drupal is a registered trademark of Dries Buytaert.