Making WordPress.org

Changeset 2693


Ignore:
Timestamp:
03/03/2016 11:05:06 PM (9 years ago)
Author:
iandunn
Message:

WordCamp Budgets: Allow saving drafts without filling out required fields.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/wordcamp-budgets.js

    r2682 r2693  
    2222            needsIntermediaryBank.change( app.toggleIntermediaryBankFields );
    2323            needsIntermediaryBank.trigger( 'change' ); // Set the initial state
     24
     25            $( '#wcb-save-draft' ).click( app.makeFieldsOptionalForDrafts );
     26        },
     27
     28        /**
     29         * Make all required input field optional when saving a draft.
     30         *
     31         * Otherwise the user would have to potentially fill out dozens of fields when they're not ready to.
     32         *
     33         * @param {object} event
     34         */
     35        makeFieldsOptionalForDrafts : function( event ) {
     36            $( '#poststuff' ).find( ':input[required]' ).each( function( fieldIndex, inputField ) {
     37                $( inputField ).prop( 'required', false );
     38            } );
    2439        },
    2540
Note: See TracChangeset for help on using the changeset viewer.