standard html button within a web2py view

33 views
Skip to first unread message

james c.

unread,
Apr 27, 2021, 6:54:15 PM4/27/21
to web2py-users
Is it possible to use standard html elements, for example a button, in a web2py view. 

I've tried both within the default controller and a separate controller named a_net.py and in both cases the function and views are named payment. In both cases, a link:  {{ =this_link }} is populated with the correct link, but all the html code does not load in the browser. Only, the variables that were returned to the view, and their correct values are displayed. The URL to the view, with the function in default is: "localhost:8000/mpay/default/payment" and with not using default: "localhost:8000/mpay/a_net/payment" 

None of the html code is in the browser, just the list of variables and their values that the function returned to the view. So is it possible to use a standard html element, like a button, and have only that button displayed in a browser?

Thanks in advance for any recommendations, James

Dave S

unread,
Apr 28, 2021, 3:31:05 AM4/28/21
to web2py-users
On Tuesday, April 27, 2021 at 3:54:15 PM UTC-7 james c. wrote:
Is it possible to use standard html elements, for example a button, in a web2py view. 

Short answer: yes.  Things like <h3> and <li> are scattered through the examples like welcome/views/default/index.html.  And I think I built a button in a controller at least once, though the example isn't handy on this computer.  That button would have been part of a string variable passed in the response, if memory serves.


I've tried both within the default controller and a separate controller named a_net.py and in both cases the function and views are named payment. In both cases, a link:  {{ =this_link }} is populated with the correct link, but all the html code does not load in the browser. Only, the variables that were returned to the view, and their correct values are displayed. The URL to the view, with the function in default is: "localhost:8000/mpay/default/payment" and with not using default: "localhost:8000/mpay/a_net/payment" 


in payment.html:

<HTML-thingy>{{=this_link}}</HTML-thingy>

 
None of the html code is in the browser, just the list of variables and their values that the function returned to the view. So is it possible to use a standard html element, like a button, and have only that button displayed in a browser?

Thanks in advance for any recommendations, James

/dps
 

jonatha...@whatho.net

unread,
Apr 29, 2021, 1:43:11 AM4/29/21
to web2py-users
I would have a read of this and the following section in the book. http://www.web2py.com/books/default/chapter/29/03/overview#Simple-examples. It fairly quickly gets on to ways to include html.
Reply all
Reply to author
Forward
0 new messages