Adding a Clear Button to Reset All Fields in Your Form

document.addEventListener(‘DOMContentLoaded’, function() { // Change the form ID to match your WPForms form ID var form = document.getElementById(‘wpforms-form-10’); if (form) { var clearButton = document.createElement(‘button’); clearButton.type = ‘button’; clearButton.innerText = ‘Clear’; clearButton.class = ‘custom-btn’; clearButton.style.marginTop = ’10px’; clearButton.classList.add(‘custom-clear-button’); form.appendChild(clearButton); clearButton.addEventListener(‘click’,…Continue reading

How to Store Field Values in the WPForms Entry

/** * Show values in Dropdown, checkboxes, and Multiple Choice. */ add_action( ‘wpforms_fields_show_options_setting’, ‘__return_true’ ); /** * Save choices ‘values’ instead of ‘labels’ for the fields with ‘Show values’ option enabled. * * @link https://wpforms.com/developers/how-to-store-field-values-in-the-wpforms-entry/ */ function wpf_dev_process_filter_choices_values( $fields, $entry,…Continue reading

class DeleteUploadedFiles {}

/** * Class deleteuploadedfiles to delete uploaded files from the server * * @link https://wpforms.com/developers/class-deleteuploadedfiles/ */ namespace WPF; class DeleteUploadedFiles { /** * Should we delete files from the WordPress Media Library? * Change the constant to true to delete…Continue reading

Changing the Name Attribute of a Hidden Field

/** * Custom function to change the name attribute of hidden fields in any form. * * @link https://wpforms.com/developers/how-to-change-the-name-attribute-of-a-hidden-field/ */ function wpf_field_properties_hidden( $properties, $field, $form_data ) { // Optional, you can limit to specific forms. Below, we restrict output to…Continue reading

Customizing Checkbox and Radio Fields to Look Like Buttons (All Forms)

.wpforms-container input[type=radio], .wpforms-container input[type=checkbox] { position: absolute; opacity: 0; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;} .wpforms-container input[type=radio] + label, .wpforms-container input[type=checkbox] + label { padding: 5px 10px !important; background-color:…Continue reading

Customizing Checkbox and Radio Fields to Look Like Buttons (Specific Forms)

.wpforms-container form#wpforms-form-1000 input[type=radio], .wpforms-container form#wpforms-form-1000 input[type=checkbox] { position: absolute; opacity: 0; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; } .wpforms-container form#wpforms-form-1000 input[type=radio] + label, .wpforms-container form#wpforms-form-1000 input[type=checkbox] + label {…Continue reading