Title: PLEASE HELP &#8211; custom question answer type date
Last modified: October 1, 2024

---

# PLEASE HELP – custom question answer type date

 *  Resolved [totallyhorse](https://wordpress.org/support/users/totallyhorse/)
 * (@totallyhorse)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/please-help-custom-question-answer-type-date/)
 * Hello,
 * Could someone please help me out? I added a custom question (experience date)
   that needs to be answered with a valid date instead of text or number (possibilities
   now-on site review form). The question is required and the date can’t be older
   than 12 months or in the future. I tried different codes and none is the perfect
   one. Custom script at the moment:
 *     ```wp-block-code
       jQuery(document).ready(function($) {       $('input[id^="cr_onsite_"][type="text"]').attr('type', 'date');       var today = new Date();    var oneYearAgo = new Date(today);    oneYearAgo.setFullYear(today.getFullYear() - 1);    $('input[id^="cr_onsite_"][type="date"]').each(function() {        $(this).attr('min', oneYearAgo.toISOString().split('T')[0]);         $(this).attr('max', today.toISOString().split('T')[0]);         $(this).attr('required', true);     });        $('#cr-review-form').on('submit', function(event) {        var isValid = true;        $('input[id^="cr_onsite_"][type="date"]').each(function() {            var dateInput = $(this).val();            var inputDate = new Date(dateInput);                                   if (!dateInput) {                isValid = false;                alert('Dit veld mag niet leeg zijn.');                $(this).focus();                 return false;            }                       if (inputDate.toString() === 'Invalid Date') {                isValid = false;                alert('Voer een geldige datum in.');                $(this).focus();                 return false;             }                        if (inputDate < oneYearAgo || inputDate > today) {                isValid = false;                alert('De datum moet binnen het afgelopen jaar liggen.');                $(this).focus();                 return false;             }        });                if (!isValid) {            event.preventDefault();        }    });});
       ```
   
 * The field can still be send in empty or with a invalid date like 31-09-2024. 
   Is it possible to make this field required again by filling in a date (instead
   of number or text)?
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fplease-help-custom-question-answer-type-date%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Support [pear8398](https://wordpress.org/support/users/pear8398/)
 * (@pear8398)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/please-help-custom-question-answer-type-date/#post-18050048)
 * Hi,
 * Thanks for using CusRev.
 * Supporting the customization code is beyond our scope. I would recommend contacting
   an expert developer to help you customize the custom question input type.
 *  Plugin Support [bagel1317](https://wordpress.org/support/users/bagel1317/)
 * (@bagel1317)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/please-help-custom-question-answer-type-date/#post-18079010)
 * We haven’t heard from you for more than two weeks. For this reason, I’ll assume
   that either you are not interested in this question/problem anymore or it has
   been resolved. If you still require any help, please start a new forum topic.

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

The topic ‘PLEASE HELP – custom question answer type date’ is closed to new replies.

 * ![](https://ps.w.org/customer-reviews-woocommerce/assets/icon-256x256.png?rev
   =2532349)
 * [Customer Reviews for WooCommerce](https://wordpress.org/plugins/customer-reviews-woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/customer-reviews-woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/customer-reviews-woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/customer-reviews-woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/customer-reviews-woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/customer-reviews-woocommerce/reviews/)

## Tags

 * [date](https://wordpress.org/support/topic-tag/date/)

 * 2 replies
 * 3 participants
 * Last reply from: [bagel1317](https://wordpress.org/support/users/bagel1317/)
 * Last activity: [1 year, 7 months ago](https://wordpress.org/support/topic/please-help-custom-question-answer-type-date/#post-18079010)
 * Status: resolved