最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Contact Form 7- problem with submit button

programmeradmin0浏览0评论
Closed. This question is off-topic. It is not currently accepting answers.

Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.

Closed 4 years ago.

Improve this question

the problem is I am making dual language website with JS and CSS only. Language change is triggered with button, here's a sample of JS for reference:

function languageSwitch() {
  var state = $('.lang-pl:visible').length ? 'pl' : 'en';
  if (state === 'pl') {
    $('.lang-pl').css('display', 'none');
    $('.lang-en').css('display', 'inherit');
  } else {
    $('.lang-en').css('display', 'none');
    $('.lang-pl').css('display', 'inherit');
  }
  return false;
}

Everything looked great, but I hit a brick wall when it came to translating submit button. On regular fields like labels and even [acceptance] it wasn't problem and it worked like a charm:

<label> <span class="lang-pl">Imię i nazwisko *</span> <span class="lang-en">Name and surname *</span> [text* your-name] </label>

But with this code submit button isn't working- it's showing 'lang-pl' version before and after switching languages:

[submit <span class="lang-pl">Wyślij</span> <span class="lang-en">Send</span>]

Anyone have idea how to solve it?

Closed. This question is off-topic. It is not currently accepting answers.

Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.

Closed 4 years ago.

Improve this question

the problem is I am making dual language website with JS and CSS only. Language change is triggered with button, here's a sample of JS for reference:

function languageSwitch() {
  var state = $('.lang-pl:visible').length ? 'pl' : 'en';
  if (state === 'pl') {
    $('.lang-pl').css('display', 'none');
    $('.lang-en').css('display', 'inherit');
  } else {
    $('.lang-en').css('display', 'none');
    $('.lang-pl').css('display', 'inherit');
  }
  return false;
}

Everything looked great, but I hit a brick wall when it came to translating submit button. On regular fields like labels and even [acceptance] it wasn't problem and it worked like a charm:

<label> <span class="lang-pl">Imię i nazwisko *</span> <span class="lang-en">Name and surname *</span> [text* your-name] </label>

But with this code submit button isn't working- it's showing 'lang-pl' version before and after switching languages:

[submit <span class="lang-pl">Wyślij</span> <span class="lang-en">Send</span>]

Anyone have idea how to solve it?

Share Improve this question asked Sep 25, 2018 at 7:39 pixelovepixelove 211 silver badge2 bronze badges 5
  • Have you tried setting css displayto block or inlineinstead of inherit? Also, is your languageSwitch() function called at all? It's defined in your code, but not actually called. – Pim Commented Sep 25, 2018 at 8:09
  • Just tried, didn't work- I am not sure about Contact Form 7 itself- maybe built-in elements like [submit] wasn't made for my purpose – pixelove Commented Sep 25, 2018 at 8:12
  • Is your languageSwitch() function called somewhere? – Pim Commented Sep 25, 2018 at 8:14
  • Yeah, it's starting at document.ready(); and all parts of website works perfectly- that one button isn't. – pixelove Commented Sep 25, 2018 at 8:20
  • I would say it's an issue with your conditional $('.lang-pl:visible').length, maybe you can try to grab the current language from another element and then run the rest of the code. – Pim Commented Sep 25, 2018 at 8:26
Add a comment  | 

1 Answer 1

Reset to default 2

Just found solution:

I've switched default [submit] with

<button id='submit' class='wpcf7-form-control wpcf7-submit'><span class="lang-pl">Wyślij</span> <span class="lang-en">Send</span></button>

and it works like a charm, now just styling in CSS

发布评论

评论列表(0)

  1. 暂无评论