Redirect to a thank you page in landing page form

3 replies · opened May 10, 2016

VvlimitMay 10, 2016

Hi again,

I asked a question about form not working in landing-5 few days ago. You solved the issue sending me a new php file and driving me in the right direction with the code in landing-5.html page.

Now I would like to aski you a question, ¿how can I redirect the form to a thank you page after success completion?

Best regards.

SSemicolon WebSTAFFMay 12, 2016

Hello,

Please find the contactForm: function() Function Block in the js/functions.js File and replace the Entire Function Block with the following code:

contactForm: function(){

	if( !$().validate ) {
		console.log('contactForm: Form Validate not Defined.');
		return true;
	}

	if( !$().ajaxSubmit ) {
		console.log('contactForm: jQuery Form not Defined.');
		return true;
	}

	var $contactForm = $('.contact-widget:not(.customjs)');
	if( $contactForm.length ');
				} else {
					$(form).find('.form-process').fadeIn();
				}

				$(form).ajaxSubmit({
					target: elementResult,
					dataType: 'json',
					resetForm: true,
					success: function( data ) {
						if( elementLoader == 'button' ) {
							defButton.html( defButtonText );
						} else {
							$(form).find('.form-process').fadeOut();
						}
						if( data.alert != 'error' && elementRedirect ){
							window.location.replace( elementRedirect );
							return true;
						}
						if( elementAlert == 'inline' ) {
							if( data.alert == 'error' ) {
								var alertType = 'alert-danger';
							} else {
								var alertType = 'alert-success';
							}

							elementResult.addClass( 'alert ' + alertType ).html( data.message ).slideDown( 400 );
						} else {
							elementResult.attr( 'data-notify-type', data.alert ).attr( 'data-notify-msg', data.message ).html('');
							SEMICOLON.widget.notifications( elementResult );
						}
						if( $(form).find('.g-recaptcha').children('div').length > 0 ) { grecaptcha.reset(); }
					}
				});
			}
		});

	});
}

Now, simply add the data-redirect="http://your-website.com/thank-you.html" attribute to the .contact-widget Container. Example:


	

	
		...
	

This should definitely work fine. Let us know if we can help you with anything else or if you find any further issues.

VvlimitMay 12, 2016

Thank you very much!

You have been really helpful.

I will sure rate canvas with five stars!!!

Best regards.

SSemicolon WebSTAFFMay 12, 2016

Hello,

Really Glad that your issues were resolved. Very Happy to Help! :)

Do let us know if we can help you with anything else or if you find any further issues with Canvas.

Have the same question, or something new?

Sign in to the Canvas dashboard to reply or open your own topic. Canvas owners get direct help from the SemiColonWeb team.

Reply on the dashboard