Title: datebox validation Post by: ui_user on December 17, 2013, 04:21:20 AM Hi All,
This a very basic question in have regarding datebox. How to validate the datebox value by adding a validator? I wanted to keep the datebox as editable. So I am able to input any values(like aphanumeric etc) to the date field. So using validator i wanted to check whether it is a actual date entered in mm/dd/yyyy format. Thanks and Regards user Title: Re: datebox validation Post by: stworthy on December 17, 2013, 06:19:17 PM Extend a validate rule and assign it to the datebox.
Code: <input class="easyui-datebox" required validType="..."> Title: Re: datebox validation Post by: ui_user on December 17, 2013, 11:57:44 PM Thank you for the reply.
I tried it out that way. My code is as follows $.extend($.fn.validatebox.defaults.rules, { validDate: { validator: function(value){ var date= $.fn.datebox.defaults.parser(value); alert(isNaN(Date.parse(date))); return !(isNaN(Date.parse(date))); }, message: 'Please enter a valid date.' } }); <input type="text" class="easyui-datebox" validType="validDate"/> But even if i enter alphabets and tab out, i am not getting the invalid message. This is the same case if i enter a value like 45/89/75 etc. but the alert is coming which i placed inside validator. Could you please tell, what mistake i have done? Regards Title: Re: datebox validation Post by: stworthy on December 18, 2013, 04:03:52 AM Try this:
Code: $.extend($.fn.validatebox.defaults.rules, { Title: Re: datebox validation Post by: ui_user on December 18, 2013, 05:14:40 AM It worked..
Thank you so much. Title: Re: datebox validation Post by: leela on May 23, 2014, 10:23:59 AM Try this: Code: $.extend($.fn.validatebox.defaults.rules, { Hi, i am trying to use this code to validate my dateboxes. It works fine and displays a message when the user enters wrong date, but is there a way we can empty the datebox field along with the message. Because if the user ignores the messages, the form is still being submitted with wrong value. please advise. I tried the following, but it empties the datebox field as soon as I enter a character. Is there a better solution? Code: $.extend($.fn.validatebox.defaults.rules, { |