Home Forums Porto Template basic Contact Form

This topic contains 4 replies, has 3 voices, and was last updated by  Support 1 month, 3 weeks ago. This post has been viewed 559 times

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #10019868

    noone
    Participant

    i’d flow the instruction as show in forum topic
    http://www.okler.net/forums/topic/porto-contact-form/

    Although the explanation is clear and it seems to me that I have acted according to the instructions, my contact form is not functioning and gives an error

    the contact form link:
    bnhusa.com/Development/contact-usRLast.html


    #10019873

    Support2
    Keymaster

    Hello, thanks for your purchase.

    I sent a test using your contact form and shows to me a success message. Did you received my test ?

    If not, please read and try the solutions on this topic: http://www.okler.net/forums/topic/important-contact-form-is-not-working/
    If the problem still persist, please paste your code of contact-form.php here (in private mode).

    Best Regards,

    Rodrigo.


    #10025789

    noone
    Participant

    Lightboxes Form,

    While functional it’s working fine.
    on the other end After submitting the form Instead of receiving on page message “The form successfully sent” I been directed to the PHP page that give me success message.

    Instead I want to get Same result as i get on the standard form – But for some reason
    not on the popup Lightboxes Form


    #10025790

    noone
    Participant
    This reply has been marked as private.
    #10025798

    Support
    Keymaster

    Hello, please note that in the file js/views/view.contact.js the ID of the form is different from the one you have in the lightbox, so to validate and use the ajax function on your form add the following JS code:

    (function($) {
    
    	'use strict';
    
    	/*
    	Contact Form: Basic
    	*/
    	$('#demo-form').validate({
    		submitHandler: function(form) {
    
    			var $form = $(form),
    				$messageSuccess = $('#contactSuccess'),
    				$messageError = $('#contactError'),
    				$submitButton = $(this.submitButton),
    				$errorMessage = $('#mailErrorMessage'),
    				submitButtonText = $submitButton.val();
    
    			$submitButton.val( $submitButton.data('loading-text') ? $submitButton.data('loading-text') : 'Loading...' ).attr('disabled', true);
    
    			// Ajax Submit
    			$.ajax({
    				type: 'POST',
    				url: $form.attr('action'),
    				data: {
    					name: $form.find('#name').val(),
    					email: $form.find('#email').val(),
    					subject: $form.find('#subject').val(),
    					phone: $form.find('#phone').val(),
    					message: $form.find('#message').val()
    				}
    			}).always(function(data, textStatus, jqXHR) {
    
    				$errorMessage.empty().hide();
    
    				if (data.response == 'success') {
    
    					$messageSuccess.removeClass('d-none');
    					$messageError.addClass('d-none');
    
    					// Reset Form
    					$form.find('.form-control')
    						.val('')
    						.blur()
    						.parent()
    						.removeClass('has-success')
    						.removeClass('has-danger')
    						.find('label.error')
    						.remove();
    
    					if (($messageSuccess.offset().top - 80) < $(window).scrollTop()) {
    						$('html, body').animate({
    							scrollTop: $messageSuccess.offset().top - 80
    						}, 300);
    					}
    
    					$form.find('.form-control').removeClass('error');
    
    					$submitButton.val( submitButtonText ).attr('disabled', false);
    					
    					return;
    
    				} else if (data.response == 'error' && typeof data.errorMessage !== 'undefined') {
    					$errorMessage.html(data.errorMessage).show();
    				} else {
    					$errorMessage.html(data.responseText).show();
    				}
    
    				$messageError.removeClass('d-none');
    				$messageSuccess.addClass('d-none');
    
    				if (($messageError.offset().top - 80) < $(window).scrollTop()) {
    					$('html, body').animate({
    						scrollTop: $messageError.offset().top - 80
    					}, 300);
    				}
    
    				$form.find('.has-success')
    					.removeClass('has-success');
    					
    				$submitButton.val( submitButtonText ).attr('disabled', false);
    
    			});
    		}
    	});
    
    }).apply(this, [jQuery]);

    Please try that and let me know if you need further assistance.

    Kind Regards,

    Jonas


Viewing 5 posts - 1 through 5 (of 5 total)