3.2.0

disable automatic linking in grids



In my editable grids, whenever I type a web address or email address in, it automatically gets a blue underline and a hand pointer, and works as an anchor tag if clicked.

I have no toolbars installed - No Google toolbar, no yahoo toolbar, no other toolbars. I've tried this on several different machines and experience the same problem on all configurations.

There's no other code included that's doing this - it happens when using just the activewidgets example code.

Replicate by typing www.google.com followed by a space character into any cell in the example below.

<html>
<head>
    <title>ActiveWidgets Examples</title>
    <script src="../../runtime/lib/aw.js"></script>
    <link href="../../runtime/styles/xp/aw.css" rel="stylesheet"></link>
</head>
<body>
<script>

    var obj = new AW.UI.Grid;
    obj.setCellText(function(i, j){return ''});
    
    var text = new AW.Formats.String;
    var html = new AW.Formats.HTML;

    obj.setCellFormat(text, 0); // text in the first column
    obj.setCellFormat(html, 1); // html in the second column
    
    obj.setHeaderText(["text", "html", "default"]);

    obj.setColumnCount(3);
    obj.setRowCount(10);

    obj.setCellEditable(true);

    document.write(obj);

</script>
</body>
</html>



There must be some way to turn this off.

Robin
December 11,
Happens in IE6 and IE7.
Doesn't happen in Firefox.
Robin
December 11,
The 'Underline Links' setting in the Browser section in IE's Advanced settings tab controls this - so it is IE itself that is creating the links. I can turn off the underline, but I cannot turn off the linking.

Is there any way ActiveWidgets can override this annoying behaviour of IE?
Robin
December 11,
:-(

apparently this is built-in behavior in IE. Could be reproduced without AW, just with

<div contentEditable="true">some text</div>


I don't know how to disable this behavior in IE. Possible workaround is to use AW cell validation -

obj.onCellTextChanging = function(text, col, row){
    if (text.match("<A")) {
        this.setCellText(text.replace(/<.+?>/g, ""), col, row);
        return true; // cancel change
    }
}
Alex (ActiveWidgets)
December 11,
Thanks Alex,

That replacement looks like it should do the trick.

Will give it a try.
Robin
December 12,
Nope, still does not work. If you put an e-mail address in a grid cell then click another cell it still links it.

I tried the same function on obj.onCellValidated and does not work
Lee
December 12,
bump
Lee
December 18,
Perhaps you could make the cell editable only when it is selected, something like this:

obj.onCellSelected = function(event,index){obj.setCellEditable(true);};
obj.onCellUnselected = function(event,index{obj.setCellEditable(false);};


(Note: this is just pseudocode - I haven't looked up the actual functions for this).
David K
December 18,

This topic is archived.

See also:


Back to support forum