0

I'm wanting to set the tab order on my forms to go left to right. I've seen the following code around the web

for (var i = 0; i < crmForm.all.length; i++) 
{
    var element = crmForm.all[i];
    if (element.tabIndex && element.tabIndex != "0") {
        if (element.className == 'ms-crm-Hidden-NoBehavior') 
            continue;
        if (element.tagName == 'A') {
            if (element.className != 'ms-crm-InlineTabHeaderText') 
                continue;
        }

        element.tabIndex = 10000 + (i * 10);
    }
}  

which sets the tab order as i want it. However there is a problem when it comes to currency fields as when you first tab into it the currency symbol is selected, and you can't type anything, and you have to tab again to be able to type anything into the field.

Is there a way for the code to ignore these symbols and go straight into the field itself?

Thanks

2 Answers 2

2

Your approach constitutes an unsupported customisation, but with a little manual work you can achieve the same outcome in a fully supported way. All you need to do is add a new "Section" (without showing the header or divider) to your form, for every row of fields.

The result is no unsupported JScript and predictable behaviour that is entirely consistent with the rest of the application.

In my example below I show an example of how I must lay out my form so that native tabbing behaviour "makes sense". However if I wish to use horizontal tabbing, I can rearrange my form, introduce some new sections and then have it work as I want without code.

The beauty of this approach is that it only affects the parts of the form that you want it to.

Example of imposing tab order using form layout

Sign up to request clarification or add additional context in comments.

3 Comments

ah right, so the code I have posted is unsupported? My guess is then that there isn't really a supported code method to do this
I'm afraid not. Simple way to check - search for "tab order" in the CRM SDK. If it doesn't appear then you can be pretty sure there is no supported method to do this.
fair enough. Thanks for your help
0

While technically it's unsupported still, I seem to have fixed the currency problem here:

function TabOrderLefttoRight() {
    for (var i = 0; i < crmForm.all.length; i++) {
    var element = crmForm.all[i];
    if (element.tabIndex && element.tabIndex > "0") { //less than zero instead of !=
        if (element.className == 'ms-crm-Hidden-NoBehavior')
            continue;
        if (element.tagName == 'A') {
            if (element.className != 'ms-crm-InlineTabHeaderText')
                continue;
        }

        element.tabIndex = 10000 + (i);
    }
}

}

This way it does not affect items that are below 0 in tabindex (currency fields).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.