Just had a job in WordPress and Contact Form 7. My client required some fields to have default value for all the time. However, whenever user submit the form, CF7 will clear all the field once the submission is successful. After some research, i manage to find a solution to retain the field value for CF7 after submission.
Contact Form 7 to clear all field except specific one after submission, follow the steps below:-
Advertisements
- To clear all field value except the one that you need, you have to overwrite the clearForm function.
- Just edit the footer.php and add in these code before the body tag and your will be able to retain your field value after successful submission with CF7.
<script type="text/javascript"> jQuery.fn.clearForm = function() { return this.each(function() { jQuery('input', this).not('#your-selector').clearFields(); }); }; </script>*** replace #your-selector with your selector
- Now you may try to do a form submission and your selector value should be retain even the form submission is successful.
Happy Blogging!
Related posts:
How to encrypt my files in Mac OS X?
How to block all file access except one using .htaccess
Download Mozilla Thunderbird 3 Email Client
Woocommerce: How to bcc all order email to multiple recipients according to status
FCKEditor - The full feature Web based WYSIWYG HTML Editor
How to import contacts from Mac to Nokia N900
Free Yahoo POP3 Email account - Yahoo Mail SG and HK
WordPress Custom Taxonomy Pagination show 404 page not found error
Share this with your friends:-
this is what i’m facing.
whenever successful submission it will clear all the field
now this solution can let me retain my value!