Console error in TPAC: "Uncaught ReferenceError: $ is not defined"

Bug #1925237 reported by Jeff Davis
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

EG 3.7

In the TPAC, when jQuery is disabled and want_dojo = 1 (for example, on the advanced search page or when ebook_api is enabled), this line in parts/js.tt2 will produce a console error:

<script type="text/javascript">if ($('client_tz_id')) { $('client_tz_id').value = }</script>

The error message is "Uncaught ReferenceError: $ is not defined". We can avoid the error by using document.getElementById() instead of $() here.

I do not see this issue in the Bootstrap OPAC, nor on a server running EG 3.5.

Tags: pullrequest
Revision history for this message
Jeff Davis (jdavis-sitka) wrote :

Working branch user/jeffdavis/lp1925237-tpac-uncaught-reference-error changes $() to document.getElementById() in the relevant place:;a=shortlog;h=refs/heads/user/jeffdavis/lp1925237-tpac-uncaught-reference-error

tags: added: pullrequest
Revision history for this message
Jason Boyer (jboyer) wrote :

While that change does prevent that one message on the advanced search page, you can trigger it again by changing the Published Date drop down to or from 'Between' since that uses JS to show or hide the second text field.

Here's a branch that just defines $() as document.getElementById if jQuery isn't used:;a=shortlog;h=refs/heads/user/jboyer/lp1925237_dollar_what / working/user/jboyer/lp1925237_dollar_what

Revision history for this message
Mike Rylander (mrylander) wrote :

Huh, I thought we decided to just include jquery ... or at least turn on want_jquery by default. Should we? (Not that this branch shouldn't be included -- I think it should -- but FTR I'd be in favor of defaulting to including jquery.)

Revision history for this message
Jason Boyer (jboyer) wrote :

I don't recall how that worked out but since the only significant loss without jQuery is the use of $() I don't imagine it's necessary to include all of it just for that function.

Since the Bootstrap OPAC very explicitly needs jQuery the clock's ticking on this one anyway.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers