PageSourceSearch

https://onlineservices.nakheel.com/Assets/js/CtrlValAppearance.js?v=639089958405992272

js nakheel.com collected 2026-10-02 04:48:13 UTC 16,850 bytes, 469 lines download raw bytes

1
2//checks for empty string and validate the email address
3function rstCtrl(ctrl) {
4
5    var b = true;
6
7    if (!ctrl) return false;
8
9    if (!$.trim($("#" + ctrl.id).val())) {
10        $("#" + ctrl.id).css({ "border-color": "#E8594F" });
11        //$("#" + ctrl.id).prev('.faIcon').css({ "border": " 1px solid #E8594F" });
12        /*$("#" + ctrl.id).prev('.faIcon').css({ "border-right": "none" });*/
13        b = false;
14    }
15    else {
16        $("#" + ctrl.id).css({ "border-color": "#ccc" });
17        //$("#" + ctrl.id).prev('.faIcon').css({ "border-color": "#ccc" });
18        b = true;
19    }
20
21    if (ctrl.type == "email") {
22        b = IsEmail(ctrl);
23    }
24
25    //if ($("#" + ctrl.id).attr("stype") == 'login') {
26    //    //alert('going to validate login');
27    //    b = IsLogin(ctrl)
28    //}
29
30    if ($("#" + ctrl.id).attr("stype") == 'captcha') {
31        //alert('going to validate login');
32        b = IsLogin(ctrl)
33    }
34
35    ////valCtrls();
36
37    return b;
38}
39
40function removeBorder(obj) {
41    obj.style.border = 'none';
42}
43
44function showCtrlErrDiv(name, isShow) {
45    if (!isShow) {
46        $("#" + name).show();
47    }
48    else { $("#" + name).hide(); }
49
50}
51
52function IsCaptcha(ctrl) {
53    if ($("#" + ctrl.id).val() == $("#" + ctrl.id + "Hidden").val()) {
54        $("#diverrtxtcaptcha").hide();
55    }
56    else {
57        $("#diverrtxtcaptcha").show();
58    }
59}
60
61function IsLogin(ctrl) {
62    var login = $("#" + ctrl.id).val();
63    var regex = /^[a-zA-Z0-9]{5,}$/;
64
65    if (!regex.test(login)) {
66        $("#" + ctrl.id).css({ "border-color": "#E8594F" });
67        return false;
68    }
69    else {
70        $("#" + ctrl.id).css({ "border-color": "#ccc" });
71        return true;
72    }
73}
74
75function IsEmail(ctrl) {
76    
77    var email = $("#" + ctrl.id).val();
78    var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
79
80    if (!regex.test(email)) {
81        $("#" + ctrl.id).css({ "border-color": "#E8594F" });
82        return false;
83    }
84    else {
85        $("#" + ctrl.id).css({ "border-color": "#ccc" });
86        return true;
87    }
88}
89
90function showErrorDiv(b) {
91    
92    if (b == false) {
93        $("#divErrMsg").show();
94    }
95    else {
96        $("#divErrMsg").hide();
97    }
98}
99
100
101function showServerError() {
102    //for more than one error we will use it by concatenator
103    if (!$.trim($("#lblError").html())) {
104        showErrorDiv(true);
105    }
106    else {
107
108        $("#errList").append("<li>" + $("#lblError").html() + "</li>");
109        showErrorDiv(false);
110    }
111}
112
113function valOnBlurFrm(ctrlarr, ctrl, showerr) {
114    for (var i = 0; i < ctrlarr.length; i++) {
115        
116        if (ctrlarr[i] == ctrl.id) {
117            if (!$.trim($("#" + ctrlarr[i]).val())) {
118                $("#" + ctrlarr[i]).css({ "border-color": "#E8594F" });
119                if (showerr)
120                    $("#" + ctrlarr[i] + "err").show();
121            }
122            else {
123                $("#" + ctrlarr[i]).css({ "border-color": "#ccc" });
124                if (showerr)
125                    $("#" + ctrlarr[i] + "err").hide();
126            }
127
128
129        }
130    }
131}
132
133function valEmailOnBlurFrm(ctrl, showerr) {
134
135    if ($.trim($("#" + ctrl.id).val()) == '') {
136        $("#" + ctrl.id).css({ "border-color": "#ccc" });
137        //if (showerr)
138        $("#" + ctrl.id + "err").hide();
139        return true;
140    }
141    
142    if ($("#" + ctrl.id)[0].type.toUpperCase() == "email".toUpperCase()) {
143
144        b = IsEmail(ctrl);
145        if (!b) {
146            $("#" + ctrl.id).css({ "border-color": "#E8594F" });
147            if (showerr) {
148                $("#" + ctrl.id + "err i").remove();
149
150                $("#" + ctrl.id + "err").show();
151            }
152        }
153        else {
154            $("#" + ctrl.id).css({ "border-color": "#ccc" });
155            //if (showerr)
156            $("#" + ctrl.id + "err").hide();
157        }
158    }
159}
160
161function valOnSubmitFrm(ctrlarr, showerr) {
162    var b = true;
163    for (var i = 0; i < ctrlarr.length; i++) {
164
165        var cntrid = '#' + ctrlarr[i];
166        $("#" + ctrlarr[i]).css({ "border-color": "#ccc" });
167
168
169        if ($("#" + ctrlarr[i])[0].type.toUpperCase() == "checkbox".toUpperCase()) {
170            if (document.getElementById(ctrlarr[i]).checked != true) {
171
172                $("#" + "lbl" + ctrlarr[i]).css({ "border-color": "#E8594F", "border-style": "solid", "border-width": "1px" });
173                if (showerr)
174                    $("#" + ctrlarr[i] + "err").show();
175                b = false;
176            }
177            else {
178                $("#" + "lbl" + ctrlarr[i]).css({ "border-color": "#ccc" });
179                $("#" + ctrlarr[i] + "err").hide();
180            }
181        }
182        else if (!$.trim($("#" + ctrlarr[i]).val())) {
183
184            $("#" + ctrlarr[i]).css({ "border-color": "#E8594F" });
185            if (showerr)
186                $("#" + ctrlarr[i] + "err").show();
187            b = false;
188        }
189
190        ////debugger;
191        //if ($("#" + ctrlarr[i])[0].type.toUpperCase() == "email".toUpperCase()) {
192        //    ////debugger;
193        //    b = IsEmail($("#" + ctrlarr[i])[0]);
194        //    if (!b) {
195        //        if (showerr) {
196        //            $("#" + ctrlarr[i] + "err").show();
197        //        }
198
199        //    }
200        //    else {
201        //        $("#" + ctrlarr[i] + "err").hide();
202        //    }
203        //}
204    }
205    return b;
206}
207
208function valEmailsOnSubmitFrm(emailsArr, ctrlarr, showerr) {
209    var b = true;
210    for (var i = 0; i < emailsArr.length; i++) {
211
212        var cntrid = '#' + emailsArr[i];
213
214        if ($.trim($(cntrid).val()) == '' && !(ctrlarr.indexOf(emailsArr[i]) > -1)) {
215            $(cntrid).css({ "border-color": "#ccc" });
216            //if (showerr)
217            $(cntrid + "err").hide();
218            continue;
219        }
220
221        $("#" + emailsArr[i]).css({ "border-color": "#ccc" });
222
223
224        if ($("#" + emailsArr[i])[0].type.toUpperCase() == "email".toUpperCase()) {
225            ////debugger;
226            var isValidEmail = IsEmail($("#" + emailsArr[i])[0]);
227            if (!isValidEmail) {
228                b = isValidEmail;
229                //if (showerr) {
230                //    $("#" + emailsArr[i] + "err").show();
231                //}
232
233            }
234            else {
235                $("#" + emailsArr[i] + "err").hide();
236            }
237        }
238    }
239    return b;
240}
241
242function AttachmentsOnSubmitFrm(ctrlarr, showerr) {
243
244    var b = true;
245    for (var i = 0; i < ctrlarr.length; i++) {
246
247        var cntrid = '#' + ctrlarr[i];
248
249
250        if ($("#" + ctrlarr[i]).get(0).files.length === 0 || $("#hd" + ctrlarr[i]).val() == '') {
251
252            $("#" + ctrlarr[i]).css({ "border-color": "#E8594F" });
253            if (showerr)
254                $("#" + ctrlarr[i] + "err").show();
255            b = false;
256        }
257        else {
258            $("#" + ctrlarr[i]).css({ "border-color": "#ccc" });
259            //if (showerr)
260            $("#" + ctrlarr[i] + "err").hide();
261        }
262    }
263    return b;
264}
265
266function valideQMaticCalender() {
267    var b = true;
268    if ($("#qMaticDate").val() !== undefined) {
269        $("#qMaticDate").css({ "border-color": "#ccc" });
270        if (!$.trim($("#qMaticDate").val())) {
271            $("#qMaticDate").css({ "border-color": "#E8594F" });
272            b = false;
273        }
274    }
275    if ($('#timeList').length !== 0) {
276        $('#qMaticTimeerr').text('').hide();
277        if ($('#timeList > li').length === 0) {
278            $('#qMaticTimeerr').text('No time slot available').show();
279            b = false;
280        }
281        else if ($('#timeList > li').length > 0 && $('#timeList > li.active').length == 0) {
282            $('#qMaticTimeerr').text('Select a time slot.').show();
283            b = false;
284        }
285    }
286    if ($('#divqMaticidLocations').length > 0) {
287        $('#qMaticLocations').css({ "border-color": "#ccc" });
288        if (!$.trim($("#qMaticLocations").val())) {
289            $("#qMaticLocations").css({ "border-color": "#E8594F" });
290            b = false;
291        }
292    }
293    return b;
294}
295
296function valListOnSubmitFrm(ctrlarr, showerr) {
297    for (var i = 0; i < ctrlarr.length; i++) {
298
299        var obj = $("#" + ctrlarr[i]);
300        try {
301            document.getElementById(ctrlarr[i]).style.border = '1px solid #E8594F';
302
303        }
304        catch (err) {
305
306            $.alert({
307                content: err, title: 'System Error'
308                , animationBounce: 2, animationSpeed: 1500, theme: 'supervan', icon: 'glyphicon glyphicon-ban-circle'
309                , backgroundDismiss: true, confirmButton: 'OK', confirmButtonClass: 'btn-primary', columnClass: 'col-xs-12'
310            });
311        }
312
313    }
314
315    return (ctrlarr.length == 0);
316}
317var iterationCount = 0;
318function valPropsProjects() {
319    if (hdServTempPorfOptionsJSONOBJ && hdServTempPorfOptionsJSONOBJ.ServiceOptionId == ServiceOptionsEnum.None)
320        return true;
321
322    if (iterationCount > 0) {
323        var b = true;
324
325
326
327        if (hdServTempPorfOptionsJSONOBJ && hdServTempPorfOptionsJSONOBJ.ServiceOptionId == ServiceOptionsEnum.SingleProject) {
328
329            if ($.grep($('.' + ctrlUserProjectsDDL + 'DDLClass').data('dropdown').$choseList[0].childNodes, function (item, index) { return item.className == 'dropdown-selected' }).length < 1) {
330                $('#' + ctrlUserProjectsDDL + ' + a').css({ "border-color": "#E8594F", "border-style": "solid", "border-width": "1px" });
331                $('#' + ctrlUserProjectsDDL + ' + div').css({ "border-color": "#E8594F", "border-style": "solid", "border-width": "1px" });
332                b = false;
333
334                //if (showerr)
335                //    $("#" + ctrlarr[i] + "err").show();
336
337            }
338            else {
339                $('#' + ctrlUserProjectsDDL + ' + a').css('border-color', '#ccc');
340                $('#' + ctrlUserProjectsDDL + ' + div').css('border-color', '#ccc');
341                //$("#" + ctrlarr[i] + "err").hide();
342            }
343        }
344        else if (hdServTempPorfOptionsJSONOBJ && hdServTempPorfOptionsJSONOBJ.ServiceOptionId == ServiceOptionsEnum.MultipleProjects) {
345
346            if ($.grep($('.' + ctrlUserProjectsDDL + 'DDLClass').data('dropdown').$choseList[0].childNodes, function (item, index) { return item.className == 'dropdown-selected' }).length < 1) {
347                $('#' + ctrlUserProjectsDDL + ' + a').css({ "border-color": "#E8594F", "border-style": "solid", "border-width": "1px" });
348                $('#' + ctrlUserProjectsDDL + ' + div').css({ "border-color": "#E8594F", "border-style": "solid", "border-width": "1px" });
349                b = false;
350            }
351            else {
352                $('#' + ctrlUserProjectsDDL + ' + a').css('border-color', '#ccc');
353                $('#' + ctrlUserProjectsDDL + ' + div').css('border-color', '#ccc');
354            }
355
356        }
357        else if (hdServTempPorfOptionsJSONOBJ && hdServTempPorfOptionsJSONOBJ.ServiceOptionId == ServiceOptionsEnum.SingleProperty) {
358
359            if ($.grep($('.' + ctrlUserPropDDL + 'DDLClass').data('dropdown').$choseList[0].childNodes, function (item, index) { return item.className == 'dropdown-selected' }).length < 1) {
360                $('#' + ctrlUserPropDDL + ' + a').css({ "border-color": "#E8594F", "border-style": "solid", "border-width": "1px" });
361                $('#' + ctrlUserPropDDL + ' + div').css({ "border-color": "#E8594F", "border-style": "solid", "border-width": "1px" });
362                b = false;
363            }
364            else {
365                $('#' + ctrlUserPropDDL + ' + a').css('border-color', '#ccc');
366                $('#' + ctrlUserPropDDL + ' + div').css('border-color', '#ccc');
367            }
368        }
369        else if (hdServTempPorfOptionsJSONOBJ && hdServTempPorfOptionsJSONOBJ.ServiceOptionId == ServiceOptionsEnum.MultipleProperty) {
370
371            if ($.grep($('.' + ctrlUserPropDDL + 'DDLClass').data('dropdown').$choseList[0].childNodes, function (item, index) { return item.className == 'dropdown-selected' }).length < 2) {
372                $('#' + ctrlUserPropDDL + ' + a').css({ "border-color": "#E8594F", "border-style": "solid", "border-width": "1px" });
373                $('#' + ctrlUserPropDDL + ' + div').css({ "border-color": "#E8594F", "border-style": "solid", "border-width": "1px" });
374                b = false;
375            }
376            else {
377                $('#' + ctrlUserPropDDL + ' + a').css('border-color', '#ccc');
378                $('#' + ctrlUserPropDDL + ' + div').css('border-color', '#ccc');
379            }
380        }
381
382        else if (hdServTempPorfOptionsJSONOBJ && hdServTempPorfOptionsJSONOBJ.ServiceOptionId == ServiceOptionsEnum.SingleContract) {
383
384            if ($.grep($('.' + ctrlUserContractDDL + 'DDLClass').data('dropdown').$choseList[0].childNodes, function (item, index) { return item.className == 'dropdown-selected' }).length < 1) {
385                $('#' + ctrlUserContractDDL + ' + a').css({ "border-color": "#E8594F", "border-style": "solid", "border-width": "1px" });
386                $('#' + ctrlUserContractDDL + ' + div').css({ "border-color": "#E8594F", "border-style": "solid", "border-width": "1px" });
387                b = false;
388            }
389            else {
390                $('#' + ctrlUserContractDDL + ' + a').css('border-color', '#ccc');
391                $('#' + ctrlUserContractDDL + ' + div').css('border-color', '#ccc');
392            }
393        }
394
395        else if (hdServTempPorfOptionsJSONOBJ && hdServTempPorfOptionsJSONOBJ.ServiceOptionId == ServiceOptionsEnum.SingleCheque) {
396
397            if ($.grep($('.' + ctrlUserChequeDDL + 'DDLClass').data('dropdown').$choseList[0].childNodes, function (item, index) { return item.className == 'dropdown-selected' }).length < 1) {
398                $('#' + ctrlUserChequeDDL + ' + a').css({ "border-color": "#E8594F", "border-style": "solid", "border-width": "1px" });
399                $('#' + ctrlUserChequeDDL + ' + div').css({ "border-color": "#E8594F", "border-style": "solid", "border-width": "1px" });
400                b = false;
401            }
402            else {
403                $('#' + ctrlUserChequeDDL + ' + a').css('border-color', '#ccc');
404                $('#' + ctrlUserChequeDDL + ' + div').css('border-color', '#ccc');
405            }
406        }
407        return b;
408    }
409    iterationCount++;
410}
411
412function valServiceProvidersMultiSelect() {
413    var b = true;
414    if (hdServTempPorfOptionsJSONOBJ && hdServTempPorfOptionsJSONOBJ.AddServiceProvider) {
415        validateSubCategoriesSelection();
416
417        if (listServiceProviderIds.length == 0) {
418            $('#' + ctrlUserServiceProviderDDL + ' + a').css({ "border-color": "#E8594F", "border-style": "solid", "border-width": "1px" });
419            $('#' + ctrlUserServiceProviderDDL + ' + div').css({ "border-color": "#E8594F", "border-style": "solid", "border-width": "1px" });
420            b = false;
421        }
422        else {
423            $('#' + ctrlUserServiceProviderDDL + ' + a').css('border-color', '#ccc');
424            $('#' + ctrlUserServiceProviderDDL + ' + div').css('border-color', '#ccc');
425        }
426    }
427    else if (hdServTempPorfOptionsJSONOBJ && hdServTempPorfOptionsJSONOBJ.AddCatSubCat) {
428        validateSubCategoriesSelection();
429    }
430    return b;
431
432    function validateSubCategoriesSelection() {
433        if (listSubCategoryIds.length == 0) {
434            $('#' + ctrlUserSubCategoryDDL + ' + a').css({ "border-color": "#E8594F", "border-style": "solid", "border-width": "1px" });
435            $('#' + ctrlUserSubCategoryDDL + ' + div').css({ "border-color": "#E8594F", "border-style": "solid", "border-width": "1px" });
436            b = false;
437        }
438        else {
439            $('#' + ctrlUserSubCategoryDDL + ' + a').css('border-color', '#ccc');
440            $('#' + ctrlUserSubCategoryDDL + ' + div').css('border-color', '#ccc');
441        }
442    }
443}
444
445function hideShowCtrl(ctrlarr, show) {
446    for (var i = 0; i < ctrlarr.length; i++) {
447        if (show)
448            $('#' + ctrlarr[i]).show();
449        else
450            $('#' + ctrlarr[i]).hide();
451    }
452}
453
454function makeCtrlDisable(ctrlarr, disable) {
455    for (var i = 0; i < ctrlarr.length; i++) {
456        if (disable)
457            $('#' + ctrlarr[i]).attr('disabled', 'disabled');
458        else
459            $('#' + ctrlarr[i]).removeAttr('disabled');
460    }
461}
462
463function removeCtrlsErrorHighlight(ctrlarr) {
464    if (ctrlarr && ctrlarr.length > 0)
465        for (var i = 0; i < ctrlarr.length; i++) {
466            var cntrid = '#' + ctrlarr[i];
467            $("#" + ctrlarr[i]).css({ "border-color": "#ccc" });
468        }
469}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.