• Resolved chtoma27587

    (@chtoma27587)


    Hi folks,

    I have a problem regarding the text of the submit button (id: send).

    In my form there is a checkbox (id: staff).
    Now I’d like to have the following scenario:

    If someone checks the checkbox, the text of the submit button should change from “send” to “buy”.

    Is it possible to write the code into the “additional settings”-field or where should I put it in?

    Thanks!

    https://ww.wp.xz.cn/plugins/contact-form-7/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Looks like you are looking for Conditional Logic which is not available directly in the Contact Form 7 plugin. It can be done via custom programing but you would need to be rather skilled at WordPress development using PHP and/or jQuery.

    Some of the premium Form plugins do offer some Conditional Logic including Gravity Forms and Ninja Forms.

    Thread Starter chtoma27587

    (@chtoma27587)

    Ok thanks, but a premium Plugin is not an option unfortunately.

    I just got a workaround with which I solved my problem:

    <input name="chkCheckbox" type="checkbox" onclick="if (this.checked) { document.getElementById('anmeldungkostenpflichtig').style.visibility='hidden';  document.getElementById('anmeldung').style.visibility='visible'; } else { document.getElementById('anmeldung').style.visibility='hidden';  document.getElementById('anmeldungkostenpflichtig').style.visibility='visible';} "/> Testtext
    
    <p>[submit id:anmeldung "Anmelden"]</p>
    <p>[submit id:anmeldungkostenpflichtig "Kostenpflichtig Anmelden"]</p>

    So I just made up two different submit buttons, one of them is hidden, the other is invisible – dependent on the checkbox.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Change button text when checkbox checked’ is closed to new replies.