CRM 2011 Script om de focus op een veld te zetten

In CRM 2011 heb ik van een formulier bijna alle velden alleen lezen gemaakt. Het nadeel van deze stap is dat CRM automatisch de focus zet op het enige nog wijzigbare veld dat ergens onderaan de pagina zit. Een gebruiker moet hierdoor telkens naar boven scrollen als hij een formulier opent. Hieronder een javascript functie om de focus weer goed te zetten. Deze functie is daarnaast vast ook nog nuttig voor allerhande andere zaken.

1
2
3
4
5
6
7
//function to set the focus on een certain field
function SetFocusOnField(fieldName) {
    if (fieldName != null) {
        var control = Xrm.Page.ui.controls.get(fieldName);
        control.setFocus();
    }
}

Mijn bron: CRM 2011 – How to set focus using Javascript

This entry was posted in crm and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>