Title: Datepicker Client Side Validation not working
Last modified: December 18, 2017

---

# Datepicker Client Side Validation not working

 *  Resolved [ariasbros](https://wordpress.org/support/users/ariasbros/)
 * (@ariasbros)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/datepicker-client-side-validation-not-working/)
 * Client-side validation message won’t be shown for date fields. This can be solved
   by moving the script tag **after** the span tag that holds the message. This 
   could also happen to color fields, but I haven’t tried those.

Viewing 1 replies (of 1 total)

 *  Plugin Author [Saravana Kumar K](https://wordpress.org/support/users/mycholan/)
 * (@mycholan)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/datepicker-client-side-validation-not-working/#post-9802067)
 * Thanks I will release the fix with my next release. until then if you want please
   update your `wc-fields-factory/assets/js/wcff-client.js` file with the following
   snippet.
 * LN : **333**
 *     ```
       this.doValidate = function( field ) {			
       			if( field.attr("wccpf-type") !== "radio" && field.attr("wccpf-type") !== "checkbox" && field.attr("wccpf-type") !== "file" ) {
       				if(field.attr("wccpf-type") !== "select") {
       					if( this.doPatterns( field.attr("wccpf-pattern"), field.val() ) ) {						
       						field.nextAll('.wccpf-validation-message:first').hide();
       					} else {						
       						this.isValid = false;
       						field.nextAll('.wccpf-validation-message:first').show();
       					}
       				} else {
       					if (field.val() !== "" && field.val() !== "wccpf_none") {
       						field.nextAll('.wccpf-validation-message:first').hide();
       					} else {
       						this.isValid = false;
       						field.nextAll('.wccpf-validation-message:first').show();
       					}
       				}							
       			} else if( field.attr("wccpf-type") === "radio" ) {				
       				if( field.closest("ul").find("input[type=radio]").is(':checked') ) {
       					field.closest("ul").next().hide();
       				} else {
       					field.closest("ul").next().show();
       					this.isValid = false;					
       				}	 			
       			} else if( field.attr("wccpf-type") === "checkbox" ) {			
       				var values = field.closest("ul").find("input[type=checkbox]:checked").map(function() {
       				    return this.value;
       				}).get();
       				if( values.length === 0 ) {
       					field.closest("ul").next().show();
       					this.isValid = false;
       				} else {						
       					field.closest("ul").next().hide();
       				}			
       			} else if( field.attr("wccpf-type") === "file" ) {				
       				if( field.val() == "" ) {
       					field.nextAll('.wccpf-validation-message:first').show();
       					this.isValid = false;
       				} else {
       					field.nextAll('.wccpf-validation-message:first').hide();
       				}									
       			}
       		}
       ```
   
    -  This reply was modified 8 years, 4 months ago by [Saravana Kumar K](https://wordpress.org/support/users/mycholan/).

Viewing 1 replies (of 1 total)

The topic ‘Datepicker Client Side Validation not working’ is closed to new replies.

 * ![](https://ps.w.org/wc-fields-factory/assets/icon-128x128.jpg?rev=2738843)
 * [WC Fields Factory](https://wordpress.org/plugins/wc-fields-factory/)
 * [Support Threads](https://wordpress.org/support/plugin/wc-fields-factory/)
 * [Active Topics](https://wordpress.org/support/plugin/wc-fields-factory/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wc-fields-factory/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wc-fields-factory/reviews/)

## Tags

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

 * 1 reply
 * 2 participants
 * Last reply from: [Saravana Kumar K](https://wordpress.org/support/users/mycholan/)
 * Last activity: [8 years, 4 months ago](https://wordpress.org/support/topic/datepicker-client-side-validation-not-working/#post-9802067)
 * Status: resolved