What is the purpose of data-w2p_disable_with?

197 views
Skip to first unread message

User

unread,
Dec 30, 2013, 5:39:53 PM12/30/13
to web...@googlegroups.com
Links I build with the anchor A html helper look like:

<a href="/myapp/mycontroller/view/5" data-w2p_disable_with="default">Anchor Text</a>

What is the purpose of the data-w2p_disable_with = "default" attribute and how can I remove it?

Anthony

unread,
Dec 30, 2013, 8:18:11 PM12/30/13
to web...@googlegroups.com
That's so the link can be temporarily disabled (the text will be replaced with "Working...") when it is used to trigger an Ajax request. However, I don't know why it's included in the anchor tag in all cases -- seems like it would only be needed when the "cid", "component", or "callback" arguments are used.

Anthony

User

unread,
Jan 4, 2014, 1:25:43 AM1/4/14
to web...@googlegroups.com
Good to know.  How can I remove it for all my links?

User

unread,
Jan 20, 2014, 2:22:17 PM1/20/14
to web...@googlegroups.com
Anyone know how to remove it?  I'm about to switch to using raw html instead of A helper but if someone knows a way to remove the "data-w2p_disable_with" attribute I'd rather do that.  If there is not an official way perhaps there is a hack where I could redefine the A helper somehow

Anthony

unread,
Jan 20, 2014, 5:39:59 PM1/20/14
to web...@googlegroups.com
It shouldn't be causing any problems, so you don't really have to remove it. Unfortunately, it is inserted by the .xml() method, so you can't just manipulate the A() object. Instead, you can do:

{{=XML(A(...).xml().replace(' data-w2p_disable_with="default"', ''))}}

I suppose you could make a class that does that:

class A2(A):
   
def xml(self):
       
return super(A2, self).xml().replace(' data-w2p_disable_with="default"', '')

Anyway, we should probably change the behavior of A() so it doesn't add that attribute when not needed.

Anthony

User

unread,
Jan 26, 2014, 10:03:22 PM1/26/14
to web...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages