locked
Case detection (Upper Lower Proper) RRS feed

  • Question

  • Hi everyone,

    Is there a way to detect if fields are all upper or lower case, and then take appropriate action?

    Many Thanks

    D

    Friday, June 5, 2015 8:29 AM

Answers

  • Hi,

    Check the below link it has the code to check the case of character.

    http://stackoverflow.com/questions/1027224/how-can-i-test-if-a-letter-in-a-string-is-uppercase-or-lowercase-using-javascrip

    Here is the entire code:-

    var strings = Xrm.Page.getAttribute(“CRMFieldSchemaName”).getValue() ;
    var i=0;
    var ch='';
    while (i <= strings.length){
        character = strings.charAt(i);
        if (!isNaN(character * 1)){
        	alert('character is numric');
        }else{
        	if (character == character.toUpperCase()) {
                    //Your Logic here
        		alert ('upper case true');
        	}
        	if (character == character.toLowerCase()){
                    //Your Logic here
        		alert ('lower case true');
        	}
        }
        i++;
    }

    Hope this helps!!!

    Thanks,

    Prasad

    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.


    Friday, June 5, 2015 8:59 AM