:: Forum >>

Problem with focus() after use the refresh().

Hi,

I started using Activegrid and I'm trying to use the Active.HTML.INPUT(), and after update it I'd like let the focus on it. But I can't set the focus() after use the refresh() method. It works in Firefox, but doesn't work in IE.
If I try use the focus() without use refresh(), then it works in both browsers. For example:

<html>
<head>
    <title>Test</title>
    <link href="styles/xp/grid.css" rel="stylesheet" type="text/css" ></link>
    <script src="lib/grid.js"></script>
</head>

<body>
    <script>


        var obj = new Active.HTML.INPUT();
        obj.setAttribute("type","text");
        obj.setAttribute("name","test");
        obj.setAttribute("value","TEST 1");
        document.write(obj);

        function teste() {
            obj.element().focus();
        }
    
</script>

    <br><br>
    <input type="button" value="Update" onclick="test()">
</body>
</html>


But if I try to use the refresh() before, then it doesn't work only in IE. For example:

<html>
<head>
    <title>Test</title>
    <link href="styles/xp/grid.css" rel="stylesheet" type="text/css" ></link>
    <script src="lib/grid.js"></script>
</head>

<body>
    <script>


        var obj = new Active.HTML.INPUT();
        obj.setAttribute("type","text");
        obj.setAttribute("name","test");
        obj.setAttribute("value","TEST 1");
        document.write(obj);

        function teste() {
            obj.setAttribute("value","TEST 2");
            obj.refresh();
            obj.element().focus();
        }
    
</script>

    <br><br>
    <input type="button" value="Update" onclick="test()">
</body>
</html>


Does anybody know what the problem is ?

Thanks.
Rodrigo Perenha
Monday, March 14, 2005
<a href="http://www.foo.com/" style="visibility:hidden;">Church...</a>
fh
Monday, May 2, 2005
I have found the same problem, Rodrigo. No clue as to its source yet.

"Double focusing" the element (as in calling the focus method on it twice) seems to work, but its far from an elegant or ideal solution.
It moves the text cursor around in strange ways sometimes. (To the front and back of the input box.) Still working on a proper solution. Any news? Advice? Thanks.
StefK
Wednesday, June 22, 2005

This topic is archived.


Back to support forum

Forum search