How to Validate Text fields allow only Numbers Dynamics 365 Portals.

Summary: How to Validate Text fields allow only Numbers Dynamics 365 Portals.

$(document).ready(function(){
$("#name").
keyup(function(event) {
if (
event.keyCode == 46 || event.keyCode == 8 ) {
// let it happen, don't do anything
} else if (/\D/
g.test(this.value)) {
// Filter non-digits from input value.
this.value = this.value.replace(/\D/g, '');
alert("Enter only Numbers");
}
});

});

How to Develop Sticky Footer in Microsoft Dynamics 365 CRM Portals.


Summary : How to make the Sticky Footer in Microsoft Dynamics 365 CRM Portals.



1. Navigate to Portals Tab---> Webtemplates

2. Open the Footer webtemplate and search for the following line of code

<footer role="contentinfo">

3. Replace the above line with following code.

<footer role="contentinfo" style="position:fixed;left:0;bottom:0;width:100%;">








How to Disable / Enable the Fields, Buttons and DateTime Fields with Common Code. In Dynamics 365 CRM Portals.

Summary : How to Disable / Enable the Fields, Buttons and DateTime Fields In Dynamics 365 CRM Portals.

Common Code:

function TextFieldsdisableEnable(fields, flag) {
    if (fields !== "") {
        var fieldschema = fields.split(",");
        for (var item = 0; item < fieldschema.length; item++) {
            if (fieldschema !== "" && $("#" + fieldschema[item]) !== null) {
                $("#" + fieldschema[item]).prop('disabled', flag);
            }
        }
    }
}

function DatetimeFieldsdisableEnable(fields, flag) {
    if (fields !== "") {
        var fieldschema = fields.split(",");
        for (var item = 0; item < fieldschema.length; item++) {
            if (fieldschema !== "" && $("#" + fieldschema[item]) !== null) {
                if (flag) {
                    var dateField = $("#" + fieldschema[item]);
                    // Get ‘Text’ field of Date Control
                    var displayField = dateField.nextAll(".datetimepicker").children("input");
                    // Get ‘Calendar’ Icon of Date Control
                    var dateIcon = dateField.nextAll(".datetimepicker").children("span");
                    // Make ‘Text’ field of Date Control Read-Only
                    displayField.attr("readonly", "readonly");
                    // Hide ‘Calendar’ Icon
                    dateIcon.css("display", "none");
                }
                else {
                    var dateField = $("#" + fieldschema[item]);
                    // Get ‘Text’ field of Date Control
                    var displayField = dateField.nextAll(".datetimepicker").children("input");
                    // Get ‘Calendar’ Icon of Date Control
                    var dateIcon = dateField.nextAll(".datetimepicker").children("span");
                    // Make ‘Text’ field of Date Control Read-Only
                    //displayField.attr("enabled", "enabled");
                    displayField.removeAttr("readonly");
                    // Hide ‘Calendar’ Icon
                    dateIcon.css("display", "");
                }
            }
        }
    }
}

How to Use Example:

// the first parameter is list of fields/button id's which you want to disable and second parameter pass true/false , true for disable and false for enable.

TextFieldsdisableEnable("portal_test,portal_tetsoptionset,edittBtn", true);

DatetimeFieldsdisableEnable("portal_testdate", true);



How to Create Custom Button in CRM Portals EntityForm or WebForm

Summary :  How to Create Custom Button in CRM Portals EntityForm or WebForm


Code:

$(document).ready(function () {
    var editbtn = $('<input/>').attr({ type: 'button', name: 'Edit', value: 'Edit', id: 'edittBtn', class: 'submit-btn btn btn-primary' });

// InsertButton is for the  Create Form, if you want for update form use the UpdateButton

    $("#InsertButton").after(editbtn);
    $("#edittBtn").click(function () {
       // Implement the button click logic.
    });
});




Popular Posts