Validation starts after first character and hides form
-
I’ve been using the plugin for some months and I had no problems. Suddenly now it has a strange behavior.
I sell digital products. So I normally hide fields such as the address when the customer is checking out. If he wants the invoice, he has to flag a checkbox.
This shows the fields including the one to add the VAT number.If validation is enabled, though, when the first character of the VAT number is added, the fields are concealed again. I think it is an issue with jQuery. When I disable validation everything behaves correctly.
I made a video to show you what happens. Here it is https://www.youtube.com/watch?v=fh3gyU0JHFY
-
Hi @nemoprofeta,
Hmm… Could you please let me know how did you add that “Mi serve la fattura” checkbox? Via some plugin or with some custom JS code? If it’s a plugin – please let me know which one is it. And if it’s the code, maybe you could post the code here?
Also – maybe you can tell me which our plugin’s previous version worked fine on your server, so I could check the changelog to find which changes could cause this.
Thanks for your answer and sorry for the late reply. The checkout page has been customized through the functions.php file.
Unfortunately I don’t know which one was the last working version.
I paste below the whole functions.php file
<?php /** * eleven40 Pro. * * This file adds functions to the eleven40 Pro Theme. * * @package eleven40 * @author StudioPress * @license GPL-2.0+ * @link https://my.studiopress.com/themes/eleven40/ */ // Start the engine. include_once( get_template_directory() . '/lib/init.php' ); // Setup Theme. include_once( get_stylesheet_directory() . '/lib/theme-defaults.php' ); // Set Localization (do not remove). load_child_theme_textdomain( 'eleven40', apply_filters( 'child_theme_textdomain', get_stylesheet_directory() . '/languages', 'eleven40' ) ); // Child theme (do not remove). define( 'CHILD_THEME_NAME', __( 'eleven40 Pro', 'eleven40' ) ); define( 'CHILD_THEME_URL', 'https://my.studiopress.com/themes/eleven40/' ); define( 'CHILD_THEME_VERSION', '2.2.3' ); // Add HTML5 markup structure. add_theme_support( 'html5', array( 'caption', 'comment-form', 'comment-list', 'gallery', 'search-form' ) ); // Add Accessibility support. add_theme_support( 'genesis-accessibility', array( '404-page', 'drop-down-menu', 'headings', 'rems', 'search-form', 'skip-links' ) ); // Add viewport meta tag for mobile browsers. add_theme_support( 'genesis-responsive-viewport' ); // Enqueue scripts and styles. add_action( 'wp_enqueue_scripts', 'eleven40_enqueue_scripts_styles' ); function eleven40_enqueue_scripts_styles() { wp_enqueue_script( 'eleven40-responsive-menu', get_stylesheet_directory_uri() . '/js/responsive-menu.js', array( 'jquery' ), '1.0.0' ); wp_enqueue_style( 'dashicons' ); wp_enqueue_style( 'google-fonts', '//fonts.googleapis.com/css?family=Lora:400,700|Oswald:400', array(), PARENT_THEME_VERSION ); } // Add new featured image size. add_image_size( 'grid-featured', 270, 100, TRUE ); // Add support for custom header. add_theme_support( 'custom-header', array( 'width' => 320, 'height' => 65, 'header-selector' => '.site-header .title-area', 'header-text' => false, ) ); // Add support for structural wraps. add_theme_support( 'genesis-structural-wraps', array( 'header', 'nav', 'subnav', 'site-inner', 'footer-widgets', 'footer', ) ); // Add support for additional color styles. add_theme_support( 'genesis-style-selector', array( 'eleven40-pro-blue' => __( 'eleven40 Pro Blue', 'eleven40' ), 'eleven40-pro-green' => __( 'eleven40 Pro Green', 'eleven40' ), 'eleven40-pro-red' => __( 'eleven40 Pro Red', 'eleven40' ), ) ); // Reposition the site description. remove_action( 'genesis_site_description', 'genesis_seo_site_description' ); add_action( 'genesis_before_content_sidebar_wrap', 'genesis_seo_site_description' ); // Unregister the header right widget area. unregister_sidebar( 'header-right' ); // Remove breadcrumb and navigation meta boxes. add_action( 'genesis_theme_settings_metaboxes', 'eleven40_remove_genesis_metaboxes' ); function eleven40_remove_genesis_metaboxes( $_genesis_theme_settings_pagehook ) { remove_meta_box( 'genesis-theme-settings-nav', $_genesis_theme_settings_pagehook, 'main' ); } // Rename Primary and Secondary Menu. add_theme_support( 'genesis-menus' , array( 'primary' => __( 'Header Menu', 'eleven40' ), 'secondary' => __( 'Footer Menu', 'eleven40' ) ) ); // Reposition the primary navigation menu. remove_action( 'genesis_after_header', 'genesis_do_nav' ); add_action( 'genesis_header', 'genesis_do_nav', 12 ); // Reposition the secondary navigation menu. remove_action( 'genesis_after_header', 'genesis_do_subnav' ); add_action( 'genesis_footer', 'genesis_do_subnav', 12 ); // Remove output of primary navigation right extras. remove_filter( 'genesis_nav_items', 'genesis_nav_right', 10, 2 ); remove_filter( 'wp_nav_menu_items', 'genesis_nav_right', 10, 2 ); // Reduce the secondary navigation menu to one level depth. add_filter( 'wp_nav_menu_args', 'eleven40_secondary_menu_args' ); function eleven40_secondary_menu_args( $args ){ if( 'secondary' != $args['theme_location'] ) return $args; $args['depth'] = 1; return $args; } // Add support for 3-column footer widgets. add_theme_support( 'genesis-footer-widgets', 3 ); // Add support for after entry widget. add_theme_support( 'genesis-after-entry-widget-area' ); // Relocate after entry widget. remove_action( 'genesis_after_entry', 'genesis_after_entry_widget_area' ); add_action( 'genesis_after_entry', 'genesis_after_entry_widget_area', 5 ); // Modifico il testo del footer add_filter('genesis_footer_creds_text', 'sp_footer_creds_filter'); function sp_footer_creds_filter( $creds ) { $creds = '[footer_copyright] · Anderson & Wayne SRL | Str. 1 Decembrie 94, Timisoara 300566 (Romania) VAT number RO39936184 <a href="https://www.iubenda.com/privacy-policy/255384">Privacy Policy</a>'; return $creds; } //Rimuovo titolo e descrizione dalle pagine del blog remove_action( 'genesis_before_loop', 'genesis_do_cpt_archive_title_description' ); remove_action( 'genesis_before_loop', 'genesis_do_posts_page_heading' ); remove_action( 'genesis_before_loop', 'genesis_do_blog_template_heading' ); //Rimuovo titolo e descrizione dagli archivi data remove_action( 'genesis_before_loop', 'genesis_do_date_archive_title' ); //Rimuovo titolo e descrizione da Taxonomy, Category, Tag remove_action( 'genesis_before_loop', 'genesis_do_taxonomy_title_description', 15 ); //Rimuovo titolo e descrizione dagli archivi autore remove_action( 'genesis_before_loop', 'genesis_do_author_title_description', 15 ); // Creo una custom taxonomy per gestire le serie, e la associo al custom type podcast function italianindie_taxonomies() { register_taxonomy( 'series', 'podcast', array( 'public' => true, 'labels' => array( 'name' => 'Serie', 'singular_name' => 'Serie', 'menu_name' => 'Serie', 'all_items' => 'Tutte le serie', 'new_item_name' => 'Nuova Serie', 'add_new_item' => 'Aggiungi una Serie', 'edit_item' => 'Modifica Serie', 'update_item' => 'Aggiorna Serie', 'separate_items_with_commas' => 'Separa le Serie con una virgola', 'search_items' => 'Cerca Serie', 'add_or_remove_items' => 'Aggiungi o rimuovi una Serie', 'choose_from_most_used' => 'Scegli fra le Serie più usate', ), 'rewrite' => array( 'slug' => 'series' ) ) ); } add_action( 'init', 'italianindie_taxonomies' ); // Aggiungo conversione tag %series% ai permalink function series_permalink($permalink, $post_id, $leavename) { if (strpos($permalink, '%series%') === FALSE) return $permalink; // Get post $post = get_post($post_id); if (!$post) return $permalink; // Get taxonomy terms $terms = wp_get_object_terms($post->ID, 'series'); if (!is_wp_error($terms) && !empty($terms) && is_object($terms[0])) $taxonomy_slug = $terms[0]->slug; else $taxonomy_slug = ''; // Se la serie è mancante, elimino il doppio slash consecutivo subito dopo podcast return str_replace('podcast//', 'podcast/', str_replace('%series%', $taxonomy_slug, $permalink)); } add_filter('post_type_link', 'series_permalink', 10, 3); // Risolvo l'errore 404 se ad un episodio del podcast non è assegnata alcuna serie function custom_rewrite () { add_rewrite_rule( 'podcast/([^/]+)/?$', 'index.php?podcast=$matches[1]', 'top'); flush_rewrite_rules(); } add_action ('init', 'custom_rewrite', 10, 0); function serie_mancanti( $request ){ if( array_key_exists( 'series' , $request ) && ! get_term_by( 'slug', $request['series'], 'series' ) ){ $request['podcast'] = $request['series']; $request['name'] = $request['series']; $request['post_type'] = 'podcast'; unset( $request['series'] ); } return $request; } add_filter( 'request', 'serie_mancanti' ); // Aggiungo il tipo 'podcast' function italianindie_post_types(){ register_post_type('podcast', array( 'public' => true, 'labels' => array( 'name' => 'Podcast', 'add_new' => 'Aggiungi Episodio', 'add_new_item' => 'Aggiungi un Episodio', 'menu_name' => 'Italian Indie Podcast', 'edit_item' => 'Modifica Episodio', 'all_items' => 'Tutti gli Episodi', 'singular_name' => 'Episodio', 'view_item' => 'Vedi Episodio', 'search_items' => 'Cerca Episodio', 'not_found' => 'Nessun Episodio trovato', 'not_found_in_trash' => 'Nessun Episodio trovato nel cestino' ), 'menu_icon' => 'dashicons-controls-volumeon', 'hierarchical' => false, 'capability_type' => 'post', 'has_archive' => true, //'rewrite' => array('slug' => 'podcast/%series%', 'with_front' => false ) // controllato da plugin. Attenzione all'ordine delle dichiarazioni! 'rewrite' => true // richiesto da Powerpress )); flush_rewrite_rules(); } add_action('init', 'italianindie_post_types'); // Rimuovo la date dei post ed anche il "by", con possibilità di aggiugerlo togliendo il commento function sp_post_info_filter( $post_info ) { $post_info = /*__( 'by', 'genesis' ) .*/' [post_author_posts_link] [post_comments] [post_edit]'; return $post_info; } add_filter( 'genesis_post_info', 'sp_post_info_filter' ); // Modifico il template prefedinito per le pagine corso, lezione, quiz, certificato. Modifico il template predefinito per la pagine del forum function sidebar_pagine_corso( $layout ) { if (( is_singular( 'sfwd-courses' ) )||( is_singular( 'sfwd-lessons' ) )||( is_singular( 'sfwd-quiz' ) )||( is_singular( 'sfwd-certificates' ))||( is_singular( 'sfwd-topic' ) )) { $layout = 'sidebar-content'; return $layout; } if ( is_bbpress() ) { $layout = 'content-sidebar'; return $layout; } } add_filter( 'genesis_pre_get_option_site_layout', 'sidebar_pagine_corso' ); // Rimuovo l'area widget nel footer per la pagine corso, lezione, quiz, certificato function area_widget_footer_pagine_corso() { if (( is_singular( 'sfwd-courses' ) )||( is_singular( 'sfwd-lessons' ) )||( is_singular( 'sfwd-quiz' ) )||( is_singular( 'sfwd-certificates' ))||( is_singular( 'sfwd-topic' ) )) { remove_action( 'genesis_before_footer', 'genesis_footer_widget_areas' ); } } add_action( 'genesis_before', 'area_widget_footer_pagine_corso' ); // Remove related products in WooCommerce product page remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 ); // Miglioro compatibilità tema Genesis con bbPress function compfix_bbpress_genesis(){ if ( is_bbpress() ) { // Rimuovo i breadcrumbs di default Genesis. bbPress ha già i suoi remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' ); // bbPress fa uso di the_content(). Prevengo ogni possibile intervento inatteso di Genesis su the_content() // post e meta remove_action( 'genesis_before_post_content', 'genesis_post_info' ); remove_action( 'genesis_after_post_content', 'genesis_post_meta' ); remove_action( 'genesis_entry_header', 'genesis_post_info', 12 ); remove_action( 'genesis_entry_footer', 'genesis_post_meta' ); // image e content remove_action( 'genesis_post_content', 'genesis_do_post_image' ); remove_action( 'genesis_post_content', 'genesis_do_post_content' ); remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 ); remove_action( 'genesis_entry_content', 'genesis_do_post_content' ); // In alcuni casi Genesis potrebbe caricare il suo authorbox. Prevengo questo comportamento remove_action( 'genesis_after_post', 'genesis_do_author_box_single' ); remove_action( 'genesis_entry_footer', 'genesis_do_author_box_single' ); // Prevengo il caricamento di Genesis navigation remove_action( 'genesis_after_endwhile', 'genesis_posts_nav' ); // ripristino the_content() di default (non modificato da Genesis) add_action( 'genesis_post_content', 'the_content' ); add_action( 'genesis_entry_content', 'the_content' ); } } // In alcuni Genesis potrebbe caricare i suoi campi mella pagina modifica profilo bbPress. Prevengo questo comportamento if ( !is_admin() ) { remove_action( 'show_user_profile', 'genesis_user_options_fields' ); remove_action( 'edit_user_profile', 'genesis_user_options_fields' ); remove_action( 'show_user_profile', 'genesis_user_archive_fields' ); remove_action( 'edit_user_profile', 'genesis_user_archive_fields' ); remove_action( 'show_user_profile', 'genesis_user_seo_fields' ); remove_action( 'edit_user_profile', 'genesis_user_seo_fields' ); remove_action( 'show_user_profile', 'genesis_user_layout_fields' ); remove_action( 'edit_user_profile', 'genesis_user_layout_fields' ); } add_action( 'genesis_before', 'compfix_bbpress_genesis' ); // Creo uno shortcode personalizzaato per visualizzare il messaggio HTML appropriato all'interno degli episodi del podcast function getMessaggioPodcastHandler() { // Se l'episodio non appartiene alla serie 'italianindie' significa che è chiuso, disponibile solo in abbonamento. In questo caso aggiungo il messaggio HTML if( !has_term('italianindie', 'series') ){ }else{ $testo_html = "<p>Ascolta su <a href='https://itunes.apple.com/it/podcast/italian-indie-impara-dagli-imprenditori-di-successo/id831904437?mt=2&ls=1' target='_blank' rel='noopener'>iTunes</a> (per iPhone)<br /> Ascolta su <a href='https://www.spreaker.com/show/italian-indie-podcast' target='_blank' rel='noopener'>Spreaker</a> (per Android)</p><br />".do_shortcode('[podlove-episode-web-player]'); } return $testo_html; } add_shortcode('getMessaggioPodcast', 'getMessaggioPodcastHandler'); // Creo una query personalizzata per escudere i podcast dalla home function query_personalizzata_home( $query ) { if ( is_home() && $query->is_main_query() ) { $query->set( 'post_type', array( 'post' ) ); return $query; } } add_action( 'pre_get_posts', 'query_personalizzata_home' ); // Rimuovo dal checkout Woo i cambi Telefono e Note ordine, non necessari function woocommerce_rimuovo_campi( $fields ) { unset($fields['billing']['billing_phone']); unset($fields['order']['order_comments']); return $fields; } add_filter( 'woocommerce_checkout_fields' , 'woocommerce_rimuovo_campi' ); // Rendo facoltativi dal checkout Woo i campi relativi l'indirizzo'. Saranno visualizzati solo su richiesta fattura function woocommerce_indirizzo_facoltativo( $address_fields ) { $address_fields['company']['required'] = false; $address_fields['address_1']['required'] = false; $address_fields['address_2']['required'] = false; $address_fields['city']['required'] = false; $address_fields['postcode']['required'] = false; return $address_fields; } add_filter( 'woocommerce_default_address_fields' , 'woocommerce_indirizzo_facoltativo' ); // Rendo facoltativi dal checkout Woo i campi relativi stato e provicia Saranno visualizzati solo su richiesta fattura function woocommerce_stato_e_provicia_facoltativi( $address_fields ) { //$address_fields['billing_state']['required'] = false; // non fuzionante da Woocommerce 3.5.1 $address_fields['billing_country']['required'] = false; return $address_fields; } add_filter( 'woocommerce_billing_fields', 'woocommerce_stato_e_provicia_facoltativi' ); // Rendo il campo Provincia facoltativo qualsiasi sia il paese (necessario da Woocommerce 3.5.1) function provincia_opzionale_per_ogni_paese( $locale ) { foreach( $locale as $country_code => $state_field ) { if( isset($locale[$country_code]['state']) ) { $locale[$country_code]['state']['required'] = false; } } return $locale; } add_filter( 'woocommerce_get_country_locale', 'provincia_opzionale_per_ogni_paese', 10, 1 ); // Sposto il campo email subito dopo nome e cognome function woocommerce_checkout_sposto_email( $address_fields ) { $address_fields['billing_email']['priority'] = 25; return $address_fields; } add_filter( 'woocommerce_billing_fields', 'woocommerce_checkout_sposto_email', 10, 1 ); // Inserisco un checkbox personalizzato per richiedere la fattura function checkbox_fattura_checkout_fields ( $fields ) { $fields['billing']['checkbox_fattura'] = array( 'type' => 'checkbox', 'label' => __('Mi serve la fattura', 'isFattura'), 'class' => array('form-row-wide'), 'clear' => true, 'priority' => 26, 'required' => false, ); return $fields; } add_filter( 'woocommerce_checkout_fields' , 'checkbox_fattura_checkout_fields' ); // Script jQuery caricato nella pagina checkout Woo function script_checkout_woocommerce() { $required = esc_attr__( 'required', 'woocommerce' ); ?> <script> jQuery(document).ready(function($) { // required HTML var required = '<abbr class="required" title="<?php echo $required; ?>">*</abbr>'; // Nascondo i campi facoltativi (al caricamento della schermata) $(".page-id-28651 #billing_company_field").hide(); $('#billing_country_field').hide(); $('#billing_address_1_field').hide(); $('#billing_address_2_field').hide(); $('#billing_postcode_field').hide(); $('#billing_city_field').hide(); $('#billing_state_field').hide(); $('#billing_eu_vat_number_field').hide(); // Intercetto i refresh del box PayPal e rimuovo il testo "Italian Indie" $("body").on('DOMSubtreeModified', "#payment", function() { $( "label[for='payment_method_paypal'] " ).html(function() { return $(this).html().replace('Italian Indie', ''); }); // Nascondo i campi facoltativi (dopo il caricamento asincrono) $( '#billing_company_field' ).hide(); $( '#billing_country_field' ).hide(); $( '#billing_address_1_field' ).hide(); $( '#billing_address_2_field' ).hide(); $( '#billing_postcode_field' ).hide(); $( '#billing_city_field' ).hide(); $( '#billing_state_field' ).hide(); $( '#billing_eu_vat_number_field' ).hide(); }); // Mostro o nascondo tutti i campi della fattura, in base alla checkbox $('input#checkbox_fattura').change(function(){ if (this.checked) { $( '#billing_company_field' ).slideDown("fast", function(){ $( '#billing_company_field' ).addClass( 'validate-required' ); $( '#billing_company_field > label' ).append(required); $( '#billing_country_field' ).show("fast", function(){ $( '#billing_country_field' ).addClass( 'validate-required' ); $( '#billing_country_field > label' ).append(required); $( '#billing_address_1_field' ).show("fast", function(){ $( '#billing_address_1_field' ).addClass( 'validate-required' ); $( '#billing_address_1_field > label' ).append(required); $( '#billing_address_2_field' ).show("fast", function(){ $( '#billing_address_2_field' ).addClass( 'validate-required' ); $( '#billing_address_2_field > label' ).append(required); $( '#billing_postcode_field' ).show("fast", function(){ $( '#billing_postcode_field' ).addClass( 'validate-required' ); $( '#billing_postcode_field > label' ).append(required); $( '#billing_city_field' ).show("fast", function(){ $( '#billing_city_field' ).addClass( 'validate-required' ); $( '#billing_city_field > label' ).append(required); $( '#billing_state_field' ).show("fast", function(){ $( '#billing_state_field' ).addClass( 'validate-required' ); $( '#billing_state_field > label' ).append(required); $( '#billing_eu_vat_number_field' ).show("fast", function(){ $( '#billing_eu_vat_number_field' ).addClass( 'validate-required' ); $( '#billing_eu_vat_number_field > label' ).append(required); }); }); }); }); }); }); }); }); } else { $( '#billing_company_field' ).hide(); $( '#billing_company_field' ).removeClass( 'validate-required' ); $( '#billing_company_field > label > .required').remove(); $( '#billing_country_field' ).hide(); $( '#billing_country_field' ).removeClass( 'validate-required' ); $( '#billing_country_field > label > .required').remove(); $( '#billing_address_1_field' ).hide(); $( '#billing_address_1_field' ).removeClass( 'validate-required' ); $( '#billing_address_1_field > label > .required').remove(); $( '#billing_address_2_field' ).hide(); $( '#billing_address_2_field' ).removeClass( 'validate-required' ); $( '#billing_address_2_field > label > .required').remove(); $( '#billing_postcode_field' ).hide(); $( '#billing_postcode_field' ).removeClass( 'validate-required' ); $( '#billing_postcode_field > label > .required').remove(); $( '#billing_city_field' ).hide(); $( '#billing_city_field' ).removeClass( 'validate-required' ); $( '#billing_city_field > label > .required').remove(); $( '#billing_state_field' ).hide(); $( '#billing_state_field' ).removeClass( 'validate-required' ); $( '#billing_state_field > label > .required').remove(); $( '#billing_eu_vat_number_field' ).hide(); $( '#billing_eu_vat_number_field' ).removeClass( 'validate-required' ); $( '#billing_eu_vat_number_field > label > .required').remove(); }// this.checked });// checkbox.change }); </script> <?php } add_action( 'woocommerce_after_checkout_billing_form', 'script_checkout_woocommerce'); //Disable Password Change notification email add_filter( 'send_email_change_email', '__return_false' ); //Set default pages order in admin by date function set_post_order_in_admin( $wp_query ) { global $pagenow; if ( is_admin() && 'edit.php' == $pagenow && !isset($_GET['orderby'])) { $wp_query->set( 'orderby', 'date' ); $wp_query->set( 'order', 'DESC' ); } } //change default Youtube embed size add_filter('pre_get_posts', 'set_post_order_in_admin', 5 ); add_filter( 'embed_defaults', 'sgl_bigger_embed_size' ); function sgl_bigger_embed_size() { return array( 'width' => 720, 'height' => 400 ); } //set GD as default image editor function hs_image_editor_default_to_gd( $editors ) { $gd_editor = 'WP_Image_Editor_GD'; $editors = array_diff( $editors, array( $gd_editor ) ); array_unshift( $editors, $gd_editor ); return $editors; } add_filter( 'wp_image_editors', 'hs_image_editor_default_to_gd' ); //enable tinyMCE for bbPress add_filter('bbp_after_get_the_content_parse_args', 'bbhelp__enable_tinymce_editor'); function bbhelp__enable_tinymce_editor($args) { // main option to enable TinyMCE $args['tinymce'] = true; // enable the light version of the TinyMCE $args['teeny'] = true; // disable the Text tab for the TinyMCE $args['quicktags'] = false; return $args; } //disable bbpress moderation add_filter( 'bbp_bypass_check_for_moderation', '__return_true' );
Hi @nemoprofeta,
Thanks for the code. Please give me a day or two to analyze it. Will get back to you as soon as possible.
Hi @nemoprofeta,
I’ve checked the code and it seems that the problem is in lines 418-433. I’ve commented it and it started to work normally. By the way, this code also produces a lot of “Maximum call stack size exceeded” errors on your site (you can see that on your checkout page by clicking right mouse button, then “Inspect” and then “Console”). So I’ve commented this:
/* // Intercetto i refresh del box PayPal e rimuovo il testo "Italian Indie" $("body").on('DOMSubtreeModified', "#payment", function() { $( "label[for='payment_method_paypal'] " ).html(function() { return $(this).html().replace('Italian Indie', ''); }); // Nascondo i campi facoltativi (dopo il caricamento asincrono) $( '#billing_company_field' ).hide(); $( '#billing_country_field' ).hide(); $( '#billing_address_1_field' ).hide(); $( '#billing_address_2_field' ).hide(); $( '#billing_postcode_field' ).hide(); $( '#billing_city_field' ).hide(); $( '#billing_state_field' ).hide(); $( '#billing_eu_vat_number_field' ).hide(); }); */
Now the only problem is that initially with “Mi serve la fattura” checkbox unchecked, other fields are still visible. To fix that I’ve added
$( document ).ready( function() {} )
to lines 407-415, i.e.:// Nascondo i campi facoltativi (al caricamento della schermata) $( document ).ready( function() { $(".page-id-28651 #billing_company_field").hide(); $('#billing_country_field').hide(); $('#billing_address_1_field').hide(); $('#billing_address_2_field').hide(); $('#billing_postcode_field').hide(); $('#billing_city_field').hide(); $('#billing_state_field').hide(); $('#billing_eu_vat_number_field').hide(); } );
Please take a look and let me know if it’s ok now.
P.S. And if that will help and you like the plugin, please consider leaving me a rating.
Thanks a lot. I’ll try soon!
Hello @nemoprofeta,
We hope it’s all sorted now with this issue, since we haven’t heard back, I’m going to mark this support thread as resolved.
Shall you need any further help, please feel free to reopen it or start a new one.
Best,
Omar
- The topic ‘Validation starts after first character and hides form’ is closed to new replies.