Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
how to validate two fields in grid form,eg. begin_date and end_date
20/06/2011
05:14
Avatar
kerneli
Member
Members
Forum Posts: 4
Member Since:
18/06/2011
sp_UserOfflineSmall Offline

how to validate two fields in grid form ,eg.begin_date and end_date,begin_date must less than end_date?

colMode:

{ name: 'Begin_Date', label: 'Begin_Date', width: 80, formatter: 'date', formatoptions: { newformat: 'Y-m-d' }, align: "center", editable: true, editoptions: { size: 10, dataInit: function(el) { $(el).datepicker({ dateFormat: 'yy-mm-dd' }); },
                     defaultValue: GetCurrentDate(document.all._Today.value)
                 }, formoptions: { elmsuffix: '*' }, editrules: { required: true, custom: true, custom_func: function(value, colname) { ..... } }
                 },
                 { name: 'End_Date', label: 'End_Date', width: 80, formatter: 'date', formatoptions: { newformat: 'Y-m-d' }, align: "center", editable: true, editoptions: { size: 10, dataInit: function(el) { $(el).datepicker({ dateFormat: 'yy-mm-dd' }); },
                     defaultValue: GetCurrentDate(document.all._Today.value)
                 }, formoptions: { elmsuffix: '*' },editrules: { required: true, custom: true, custom_func: function(value, colname) { ..... }
                 }

function(value, colname) { ..... }??

thanks!

20/06/2011
10:42
Avatar
kerneli
Member
Members
Forum Posts: 4
Member Since:
18/06/2011
sp_UserOfflineSmall Offline

i found a way to solve this problem:

editrules: { required: true, custom: true, custom_func: function(value, colname) { return CheckDate($("#Begin_Date").val(), $("#End_Date").val()); } }

        function CheckDate(b_date, e_date) {
            var d1 = toDate(b_date,"yyyy-MM-dd");
            var d2 = toDate(e_date, "yyyy-MM-dd");
            if ((!checkDateFormate(b_date)) || (d1 == null)) {
                return [false, "开始日期 格式错误"];
            }
            if ((!checkDateFormate(e_date)) || (d2 == null)) {
                return [false, "结束日期 格式错误"];
            }
            if (d2 < d1) {
                return [false, "结束日期 必须大于 开始日期"];
            }
            return [true, ""];
        }

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
34 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information