I found some bug about form's field validation of custom pattern format.

Did you may have found a bug in Joomla! 3.x but aren't sure? This forum is the place to help figure out if the problem is a bug and how to report it. If you are an experienced Joomla! user and are certain that you have found a bug please use the Bug Tracker to submit your issue.
This forum is for discussion about bugs and to get help with reporting them to the Bug Tracker: https://issues.joomla.org

Moderator: ooffick

Forum rules
Please use the official Bug Tracker to report a bug: https://issues.joomla.org
iamkeng
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Mon Jun 18, 2018 11:10 am

I found some bug about form's field validation of custom pattern format.

Postby iamkeng » Mon Jun 18, 2018 11:28 am

Hi,
I found some bug in media/system/js/validate.js about form's field validation of custom pattern format. JS canot validate the form with custom pattern format because found javascript error occurs with error message "l is not a function".

Because of in context of funtion i() use global variable 'l' in this statement:

Code: Select all

(l = new RegExp("^" + r.attr("pattern") + "$").test(r.val()), n(l, r), l)


So I added variable 'l' initializing to at the first line of the context of this function to make it to be local variable like as I leave message in the comment below. After that it works properly.

Code: Select all

i = function(e) {
            var a, l, r = jQuery(e);// <--- I added variable 'l' to this line after that it worksproperly.
            if (r.attr("disabled")) return n(!0, r), !0;
            if (r.attr("required") || r.hasClass("required"))
                if ("fieldset" === r.prop("tagName").toLowerCase() && (r.hasClass("radio") || r.hasClass("checkboxes"))) {
                    if (!r.find("input:checked").length) return n(!1, r), !1
                } else if (!r.val() || r.hasClass("placeholder") || "checkbox" === r.attr("type") && !r.is(":checked")) return n(!1, r), !1;
            return a = r.attr("class") && r.attr("class").match(/validate-([a-zA-Z0-9\_\-]+)/) ? r.attr("class").match(/validate-([a-zA-Z0-9\_\-]+)/)[1] : "", r.attr("pattern") && "" != r.attr("pattern") ? r.val().length ? (l = new RegExp("^" + r.attr("pattern") + "$").test(r.val()), n(l, r), l) : r.attr("required") || r.hasClass("required") ? (n(!1, r), !1) : (n(!0, r), !0) : "" === a ? (n(!0, r), !0) : a && "none" !== a && t[a] && r.val() && !0 !== t[a].exec(r.val(), r) ? (n(!1, r), !1) : (n(!0, r), !0)
        }
You do not have the required permissions to view the files attached to this post.

User avatar
mandville
Joomla! Master
Joomla! Master
Posts: 14608
Joined: Mon Mar 20, 2006 1:56 am
Location: The Girly Side of Joomla in Sussex

Re: I found some bug about form's field validation of custom pattern format.

Postby mandville » Mon Jun 18, 2018 9:02 pm

HU2HY- Poor questions = Poor answer
Un requested Help PM's will be reported, added to the foe list and possibly just deleted
{VEL Team Leader}{TM Auditor }{ Showcase & Security forums Moderator}


Return to “Joomla! 3.x Bug Reporting”

Who is online

Users browsing this forum: No registered users and 1 guest