we did a pretty heavy job to discard any inline javascript .... this goes
exactly in the opposite way. What are you seeking in functionality ? It
seems that your *button *is better suited with a normal *a*
On Sunday, September 28, 2014 10:37:33 PM UTC+2, Bernhard Radermacher wrote:
>
> I was always a bit disappointed with the features, or rather non-features
> of the html button, basically that all functionality has to be programmed
> by hand.
>
> I created a small class (and patched it into gluon.html) to make a button
> and the respective JQuery script automatically. At this time the button
> just works as a link to a page.
>
> Would like to discuss if something like this makes sense, if it would make
> more sense to add to the standard by expanding gloun.html.BUTTON to accept
> 'href' and behave accordingly...
>
>
>
> class linkBUTTON(DIV):
> """
> Pseudo Component to automatically generate JavaScript to execute on
> click
> """
>
> tag = 'linkbutton'
>
> def xml(self):
> """
> get attributes to generate the BUTTON, override _type to 'button'
> if href is defined, create the respective JavaScript
> """
> href = None
> attr = {}
> for key, value in self.attributes.iteritems():
> if key == 'href':
> href = value
> continue
> if key[:1] != '_':
> continue
> attr[key] = value
>
> attr['_id'] = uuid4()
> attr['_type'] = 'button'
>
> result = BUTTON(self.components, **attr).xml()
> if href:
> result += '\n' +
> SCRIPT("$('#%s').click(function(){window.location.assign('%s');});" %
> (attr['_id'], href)).xml()
>
> return result
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.