I'm getting the following JS error on the registration form:
Error: field.val() is undefined
Source File: http://gvep.localhost/sites/all/modules/contrib/maxlength/maxlength.js?R
Line: 7
I'm using maxlength on 2 profile fields that do not appear on the registration form. It seems this module still includes some JS in the page header to look out for these fields.
"maxlength": { "edit-field-organisation-info-0-value": "500", "edit-field-bio-0-value": "500" }
When it doesn't find them we get an error.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | maxlength.patch | 803 bytes | jpmckinney |
| #5 | maxlength.patch | 796 bytes | jpmckinney |
| #4 | maxlength-6.x-2.0-beta1-#808598.patch | 953 bytes | vladsavitsky |
| #1 | maxlength_content_profile_reg_form.patch | 1.15 KB | rsaddington |
Comments
Comment #1
rsaddington commentedAfter a bit of investigation it seems the error is triggered when using maxlength on content profile fields and then hiding them from the registration form.
The following update to maxlength.module resolve the issue for me:
The logic could perhaps be improved.
Patch file attached.
Comment #2
Orjan commentedI get this error on Firefox 3.6 and IE 8 in an add node form, but it works in chrome...
Comment #3
vladsavitsky commentedI had the same problem.
JS code is not check if element exists and this leads to errors.
I don't have time to do real patch and will do it later.
Here is my hack:
Was added just one check: if ($(field).length > 0) {
Comment #4
vladsavitsky commentedPatch solves this problem. Please test it.
Comment #5
jpmckinney commentedBetter patch, I think.
Comment #6
jpmckinney commentedForgot the
.length.Comment #7
aron novakI added the if() condition to the current JS, it makes the script much more robust.