IT LOOKS TO BE WORKING FINE NOW!
I was changing different configurations and disabling and enabling plugins ( I had a old version and i see there new and different extensions.
I was wondering if this custom code you create for me long time ago is still needed.
// JavaScript Document
/**
* jQuery extension for the Football Pool plugin
*
* The script combines the input values of all prediction forms on a page and submits all the values. With the fp-predictionform
* shortcode you can put multiple forms on a page (and maybe separate them on tabs). This script enables users to submit all these
* forms with either one of the submit buttons.
*
* (c) 2018 Antoine Hurkmans
*/
jQuery( document ).ready( function() {
// add submit handler to all football pool prediction forms
jQuery( 'form[id^=predictionform-]' ).submit( function( e ) {
// store the form that was submitted
var submitted_form = jQuery( this );
// get all other forms to attach the inputs to the submitted form
jQuery( 'form[id^=predictionform-]' ).not( submitted_form ).each( function() {
var this_form = jQuery( this );
// get all the match inputs from the form and attach as hidden input to the submitted form
jQuery( 'input[name^=_bonus_], input[name^=_home_], input[name^=_away_]', this_form ).each( function() {
var input = jQuery( this ).clone();
input.attr( 'type', 'hidden' ).appendTo( submitted_form );
} );
} );
// set form id to first form so save action is always triggered on first shortcode
var first_form = jQuery( 'form[id^=predictionform-]' ).first();
var first_form_id = jQuery( 'input[name=_fp_form_id]', first_form ).val();
jQuery( 'input[name=_fp_form_id]', submitted_form ).val( first_form_id );
// get the joker value (if set)
var joker = jQuery( 'span.fp-joker' );
if ( joker ) {
var id = joker.first().attr( 'id' );
var joker_value = id.substring( id.indexOf( '_' ) + 1 );
joker_value = joker_value.substring( 0, joker_value.indexOf( '_' ) );
jQuery( 'input[name=_joker]', submitted_form ).val( joker_value );
}
// proceed with the submit event
return;
// e.preventDefault();
} );
} );
Good to hear it is working again.
I guess you won’t need the extra javascript anymore if you use the new AJAX saves in the front-end. Regardless of where users are filling in their predictions (if you have multiple forms on the page), it should automatically save the changes. The javascript was just there to prevent that users only pressed one save button after changing predictions in multiple forms on the page.