• Resolved RVOLA

    (@rvola)


    Description

    The withdrawal form is completely broken when WordPress loads jQuery 4.x. Submitting the form throws a
    JavaScript error that prevents any validation from running.

    Error

    Uncaught TypeError: $.trim is not a function
    at validateForm (wbte-ewb-frontend.js?ver=1.0.2:238:13)
    at HTMLFormElement. (wbte-ewb-frontend.js?ver=1.0.2:455:11)

    Root cause

    jQuery.trim() was removed in jQuery 4.0.0 (it was deprecated since jQuery 3.3.0). The file
    assets/js/wbte-ewb-frontend.js calls $.trim() on three separate lines:

    • Line 238: $.trim( $( ‘#wbte_ewb_order_number’ ).val() )
    • Line 241: $.trim( $( ‘#wbte_ewb_guest_email’ ).val() )
    • Line 259: $.trim( $( ‘#wbte_ewb_reason’ ).val() ) Expected behavior The withdrawal form validates and submits correctly regardless of the jQuery version loaded. Fix Replace all $.trim( value ) calls with the native value.trim():
    • if ( ! $.trim( $( ‘#wbte_ewb_order_number’ ).val() ) ) {
    • if ( ! $( ‘#wbte_ewb_order_number’ ).val().trim() ) {
    • if ( ! $.trim( $( ‘#wbte_ewb_guest_email’ ).val() ) ) {
    • if ( ! $( ‘#wbte_ewb_guest_email’ ).val().trim() ) {
    • if ( params.reason_required === ‘yes’ && ! $.trim( $( ‘#wbte_ewb_reason’ ).val() ) ) {
    • if ( params.reason_required === ‘yes’ && ! $( ‘#wbte_ewb_reason’ ).val().trim() ) { Environment
    • jQuery: 4.0.0
    • Plugin version: 1.0.2
    • WordPress: tested up to 7.0 (as stated in plugin header)
    • WooCommerce: tested up to 10.8.1 (as stated in plugin header)
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Jeff

    (@jeffwtsupport)

    Hi @rvola,

    Thank you for reporting this issue.

    We have identified the cause and fixed it in the latest version of the plugin, v1.0.3.

    Could you please download and install the latest version and check whether the form validation is working correctly on your end?

    We appreciate your help in bringing this to our attention and look forward to your feedback.

    Thread Starter RVOLA

    (@rvola)

    Perfect, and thank you for the speed.

    Plugin Support Jeff

    (@jeffwtsupport)

    Hi @rvola,

    Thank you for confirming the fix.

    We’re glad the update resolved the issue and appreciate you taking the time to report it. Feedback like yours helps us improve the plugin and address issues more effectively.

    If you are satisfied with the plugin, we would greatly appreciate it if you could take a moment to leave us a review here.

    Thanks again for your help!

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.