Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #273261

    Hello,
    My client has requested that the contact form has a ‘reset’ button as well as a ‘submit’ button. Is there any code for this? (Me, I’d just reload the page… but oh well)
    Kind regards
    FergieGirl

    #273267

    Hey FergieGirl!

    Please add following code to Functions.php file in Appearance > Editor

    function add_custom_script(){
    ?>
    <script>
    jQuery(window).load(function(){
    jQuery("fieldset p:last-child").append("<input type='reset' class='reset-button button'>Reset</input>");
    });
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_script');

    Regards,
    Yigit

    • This reply was modified 1 month, 3 weeks ago by  Yigit.
    • This reply was modified 1 month, 3 weeks ago by  Yigit.
    #273639

    Hi Yigit,
    I pasted the code at the bottom of functions.php in the Choices theme, and got this error:
    Parse error: syntax error, unexpected ‘?’ in /clientdata/apache-www/f/o/fortun8int.com/www/wp-content/themes/choices/functions.php on line 271

    Are you able to log in using the login I provided yesterday and see if it works for you? Many thanks
    Cheers
    Fergie

    #273676

    Hi!

    The function assumes there is an already open php tag before the function starts so make sure that where you are pasting that into, in your functions.php. Or try:

    
    <?php
    function add_custom_script(){
    ?>
    <script>
    jQuery(window).load(function(){
    jQuery("fieldset p:last-child").append("<input type='reset' class='reset-button button'>Reset</input>");
    });
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_script');
    

    Cheers!
    Devin

    #273685

    HI Devin
    I tried inserting the code you gave me and still got an error:
    Parse error: syntax error, unexpected ‘<’ in /clientdata/apache-www/f/o/fortun8int.com/www/wp-content/themes/choices/functions.php on line 18
    Any help would be appreciated ;-)
    Kind regards
    Fergie

    #273716

    Hi!

    Thank you for the update.

    Please use this instead, add it at the very bottom of functions.php:

    function add_reset_button_script(){
    $reset = "<input type='reset' class='reset-button button'></input>";
    echo '<script type="text/javascript">
    jQuery.noConflict();
    jQuery(document).ready(function(){
    jQuery(".ajax_form fieldset p:last-child").append("'.$reset.'");
    });
    </script>';
    }
    add_action('wp_head', 'add_reset_button_script');

    Regards,
    Ismael

    #273742

    Hi Ismael,
    I put it at the very bottom and got this:

    Parse error: syntax error, unexpected ‘;’, expecting :: (T_PAAMAYIM_NEKUDOTAYIM) in /clientdata/apache-www/f/o/fortun8int.com/www/wp-content/themes/choices/functions.php on line 267

    Any suggestions?
    Kind regards
    Fergie

    #273768

    Hi!

    The contact form currently does not support a “reset” action and this would require some theme code customization. Please hire a freelancer if you really need this feature. Afaik even advanced contact forms like Gravity Forms don’t offer this feature out of the box – but you can download a separate plugin: https://wordpress.org/plugins/gravity-forms-reset-button/ to add such a button to the forms.

    Best regards,
    Peter

    #273771

    Thanks, Peter.
    I’ll try that with Gravity Forms.
    Kind regards
    Sabrina

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

The topic ‘Choices Contact Form: "reset" button’ is closed to new replies.