Change button to "loading" after clicked

92 views
Skip to first unread message

LoveWeb2py

unread,
Apr 23, 2014, 9:48:23 AM4/23/14
to web...@googlegroups.com
Hello,

I'm using the form=FORM('Search text:', INPUT(_name='texttofind', INPUT(_type='submit')) which generates a button and a search field on a web page when I type {{=form}}

How can I change the button to "loading" when a user clicks it

I found this documentation on jquery http://getbootstrap.com/2.3.2/javascript.html#buttons but I'm not sure how to assign it to the button.




Derek

unread,
Apr 24, 2014, 1:09:13 PM4/24/14
to web...@googlegroups.com
 I'm pretty sure you can pass the 'input' function a _data-loading-text="Loading..."

I believe that anything with an underscore in front of it gets added as an attribute. You could do it like this...

INPUT(_type='submit', _data-loading-text="Loading...", _cheese="Casu marzu")
and your input tag will be on the page like so:
<input type='submit' data-loading-text="Loading...", cheese="Casu marzu">

Niphlod

unread,
Apr 24, 2014, 3:08:19 PM4/24/14
to web...@googlegroups.com
python won't let you do _data-loading-text in that way (because of the "-" sign)

However, recent web2py releases allow you to use data={'loading-text'} ^__^

you can review this section of the book for a complete reference

http://web2py.com/books/default/chapter/29/05/the-views#HTML-helpers

Austin Taylor

unread,
Apr 24, 2014, 3:25:38 PM4/24/14
to web...@googlegroups.com
Thanks for the update Niphlod!

I'm using 2.3.2. Do you know if its available in that version? I tried using data={'loading-text':'loading} in the controller, but its not taking it for some reason.


--
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 a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/tosEHMsaL7U/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Niphlod

unread,
Apr 25, 2014, 1:11:41 PM4/25/14
to web...@googlegroups.com
no, it's not.

come on, update! 2.3.2 was released in december 2012!
Reply all
Reply to author
Forward
0 new messages