Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jun 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to fix this & make compatible with HTML5

    Hello,

    I've got this Persian textbox for my site it's working on most computers but some of them getting this problem when they trying to type two works which is on this keys: [] and replace of utf-8 persian char it appears [ or ] for them but not for me! Other keys are working great!

    I thought maybe it needed to be updated or it has some bug need to fix.

    Please anyone can help?

    PHP Code:
    function keyEnterToPersian(fielde) {
        if ((
    field.maxLength && field.maxLength != -&& field.value.length >= field.maxLength) || field.maxLength == 0) {
            return;
        }
        var 
    event document.all window.event e;
        var 
    key event.keyCode event.keyCode event.which;
        if (
    key 31) {
            if (
    key 128) {
                var 
    keys = [
                    
    0x00200x00210x061B0x066B0xFDFC0x066A0x060C0x06AF,
                    
    0x00290x00280x002A0x002B0x06480x002D0x002E0x002F,
                    
    0x06F00x06F10x06F20x06F30x06F40x06F50x06F60x06F7,
                    
    0x06F80x06F90x003A0x06A90x003E0x003D0x003C0x061F,
                    
    0x066C0x06240x200C0x06980x064A0x064D0x06250x0623,
                    
    0x06220x06510x06290x00BB0x00AB0x06210x06540x005D,
                    
    0x005B0x06520x064B0x06260x064F0x064E0x06700x064C,
                    
    0x06530x06500x06430x062C0x005C0x06860x00D70x0640,
                    
    0x200D0x06340x06300x06320x06CC0x062B0x06280x0644,
                    
    0x06270x06470x062A0x06460x06450x067E0x062F0x062E,
                    
    0x062D0x06360x06420x06330x06410x06390x06310x0635,
                    
    0x06370x063A0x06380x007D0x007C0x007B0x007E
                
    ];
                var 
    code keys[key 32];
                if (
    event.which) {
                    
    pnhMozStringInsert(fieldString.fromCharCode(code));
                    
    event.preventDefault();
                } else {
                    try {
                        
    event.keyCode code;
                    } catch(
    err) {
                    }
                }
            }
        }
    }
    function 
    pnhMozStringInsert(eltnewtext) {
        var 
    posStart elt.selectionStart;
        var 
    posEnd elt.selectionEnd;
        var 
    scrollTop elt.scrollTop;
        var 
    scrollLeft elt.scrollLeft;

        
    elt.value elt.value.slice(0posStart) + newtext elt.value.slice(posEnd);
        var 
    newpos posStart newtext.length;
        
    elt.selectionStart newpos;
        
    elt.selectionEnd newpos;
        
    elt.scrollTop scrollTop;
        
    elt.scrollLeft scrollLeft;
        
    elt.focus();

    }
    function 
    switchTextLang(fieldevent) {
        var 
    event document.all window.event event;
        if (
    event.ctrlKey && event.altKey) {
            if (
    field.lang == "fa") {
                
    field.dir "ltr";
                
    field.onkeypress = function() {
                }
            }
            else {
                
    field.dir "rtl";
                
    field.onkeypress = function(event) {
                    
    keyEnterToPersian(thisevent);
                }
            }
        }
        
    field.lang field.lang == "fa" "en" "fa";


  • #2
    Senior Coder
    Join Date
    Sep 2010
    Posts
    1,922
    Thanks
    15
    Thanked 229 Times in 229 Posts
    It's written to work in a Mozilla browser, like Firefox.

    pnhMozStringInsert

  • #3
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,535
    Thanks
    45
    Thanked 259 Times in 256 Posts
    Well, no, there's nothing in the phnMozStringInsert function that is strictly limited to Firefox.

    I'm assuming you've tried clearing your cache and trying it? Have you noticed any consistencies between computers that work such as OS and browser? The JS console doesn't show anything useful?


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •