1jQuery(function($){ 2 3 // Init form validator 4 function dtInitVontactForm () { 5 var $form = $( 'form.contact-form.dt-form' ); 6 7 $form.validationEngine( { 8 binded: false, 9 promptPosition: 'topRight', 10 scroll: false, 11 autoHidePrompt: false, 12 onValidationComplete: function( form, status ) { 13 var $form = $(form); 14 15 // If validation success 16 if ( status ) { 17 18 var data = { 19 action : 'dt_send_mail', 20 nonce: dtLocal.contactNonce, 21 widget_id: $('input[name="widget_id"]', $form).val(), 22 send_message: $('input[name="send_message"]', $form).val(), 23 fields : {} 24 }; 25 26 $form.find('input[type="text"], textarea').each(function(){ 27 var $this = $(this); 28 29 data.fields[ $this.attr('name') ] = $this.val(); 30 }); 31 32 $.post( 33 dtLocal.ajaxurl, 34 data, 35 function (response) { 36 var _caller = $(form), 37 msgType = response.success ? 'pass' : 'error'; 38 39 // Update nonce 40 dtLocal.contactNonce = response.nonce; 41 42 // Show message 43 $('input[type="hidden"]', _caller).last().validationEngine( 'showPrompt', response.errors, msgType, 'inline' ); 44 45 // set promptPosition again 46 _caller.validationEngine( 'showPrompt', '', '', 'topRight' ); 47 48 // Clear fields if success 49 if ( response.success ) { 50 _caller.find('input[type="text"], textarea').val("").unbind(); 51 } 52 } 53 ); 54 } 55 } // onValidationComplete 56 } ); 57 58 $form.find( '.dt-btn.dt-btn-submit' ).on( 'click', function( e ) { 59 e.preventDefault(); 60 var $form = $(this).parents( 'form' ); 61 $form.submit(); 62 } ); 63 64 $form.find( '.clear-form' ).on( 'click' ,function( e ) { 65 e.preventDefault(); 66 67 var $form = $(this).parents( 'form' ); 68 69 if ( $form.length > 0 ) {
70 $form.find( 'input[type="text"], textarea' ).val( "" ).unbind(); 71 $form.validationEngine( 'hide' ); 72 } 73 } ); 74 } 75 76 dtInitVontactForm(); 77});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.