WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form 7
Display name in thank you message? (7 posts)

  1. clevestam
    Member
    Posted 3 years ago #

    I have a client that want the name from the form to be displayed in the thank you message once they have filled in the form and submitted.

    How do i accomplish this?

  2. clevestam
    Member
    Posted 3 years ago #

    no edit button??

    How about getting the shortcode to work with the "messages"?
    [your-name] etc.?

  3. webjunk
    Member
    Posted 3 years ago #

    When you view the Contact Form you can edit it then click on Save at the bottom.
    When viewing the Contact form, look near the bottom and click on the Bold Messages. You can edit the Thank You message

  4. clevestam
    Member
    Posted 3 years ago #

    I know i can edit the thank you message that way, but i cant make it display the name from the input field in the message. i want the " $POST_your-name " to display.

    it just converts the shortcode to string instead of parsing it.
    im digging through the php and js files. But im just not that good at reading these script languages yet :)

  5. clevestam
    Member
    Posted 3 years ago #

    If someone could point me to the right function to modify, and what to add, I would really appreciate it.

  6. clevestam
    Member
    Posted 3 years ago #

    ...silent as the grave..... let me ask this then: Can i modify the ajax message with the JS action hook in the additional settings?

    on_sent_ok: (code);

    anyone kind enough to provide a code snippet?? :)

  7. clevestam
    Member
    Posted 3 years ago #

    If anyone is interested this is what i did to make it work, considering im a total noob with ajax, jquery and javascript in general i think i did pretty goood. The edited file is scripts.js.

    success: function(data) {
    					var ro = $(data.into).find('div.wpcf7-response-output');
    					var x=0;
    
    					$(data.into).wpcf7ClearResponseOutput();
    
    					if (data.invalids) {
    						$.each(data.invalids, function(i, n) {
    							$(data.into).find(n.into).wpcf7NotValidTip(n.message);
    						});
    						ro.addClass('wpcf7-validation-errors');
    					}
    
    					if (data.captcha)
    						$(data.into).wpcf7RefillCaptcha(data.captcha);
    
    					if (data.quiz)
    						$(data.into).wpcf7RefillQuiz(data.quiz);
    
    					if (1 == data.spam)
    						ro.addClass('wpcf7-spam-blocked');
    
    					if (1 == data.mailSent) {
    						var x=1;
    						var namnet = $('[name=your-name]').val();
    						$(data.into).find('form').resetForm().clearForm();
    						ro.addClass('wpcf7-mail-sent-ok');
    
    						if (data.onSentOk)
    							$.each(data.onSentOk, function(i, n) { eval(n) });
    					} else {
    						ro.addClass('wpcf7-mail-sent-ng');
    					}
    
    					if (data.onSubmit)
    						$.each(data.onSubmit, function(i, n) { eval(n) });
    
    					$(data.into).find('.wpcf7-use-title-as-watermark.watermark').each(function(i, n) {
    						$(n).val($(n).attr('title'));
    					});
    
    					if (x>0) {
    						ro.append('Tack ',namnet,' för ditt medelande vi hör av oss så fort vi kan.').fadeIn(1000).delay(4000).fadeOut(3000);
    						x=0;
    					}else{
    						ro.append(data.message).fadeIn(1000).delay(4000).fadeOut(3000);
    					}
    
    				}
    			});

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic