• Resolved sajeertk

    (@sajeertk)


    I think there is a typo in the else part of the function ‘filed_is_required’ from the file address-i18n.js. Looks like the class selector ‘label .optional’ is wrongly typed as ‘label .required’. It leads to displaying the text ‘(optional)’ multiple times in few cases.

    May need to replace the line
    if ( field.find( ‘label .required’ ).length === 0 )
    with
    if ( field.find( ‘label .optional’ ).length === 0 )

    Referring below function,

    function field_is_required( field, is_required ) {
    	if ( is_required ) {
    		field.find( 'label .optional' ).remove();
    		field.addClass( 'validate-required' );
    
    		if ( field.find( 'label .required' ).length === 0 ) {
    			field.find( 'label' ).append( '&nbsp;<abbr class="required" title="' + wc_address_i18n_params.i18n_required_text + '">*</abbr>' );
    		}
    	} else {
    		field.find( 'label .required' ).remove();
    		field.removeClass( 'validate-required' );
    
    		if ( field.find( 'label .required' ).length === 0 ) {
    			field.find( 'label' ).append( '&nbsp;<span class="optional">(' + wc_address_i18n_params.i18n_optional_text + ')</span>' );
    		}
    	}
    }
    • This topic was modified 6 years, 6 months ago by sajeertk.
    • This topic was modified 6 years, 6 months ago by sajeertk.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Error in address-i18n.js file’ is closed to new replies.