Events, UI elements, and brython

46 views
Skip to first unread message

Eric S. Johansson

unread,
Apr 27, 2016, 1:45:55 AM4/27/16
to brython
I've been beating my head against this problem for a while. Maybe someone here can help point me straight.

I've been experimenting with a variety of Python facilities and "ways to do things". One of the things I was trying was filling in a form and saving its results via Ajax. The basic letter simple, it's in bootstrap and in the left hand navigation column I've got the classic bootstrap
<ul id="vmi_navbar" class="nav nav-sidebar">
<li id="Alex Gibson"><a href="/webapp/name2record?mapID=Alex%20Gibson"><span>Alex Gibson</span></a></li>
<li id="Chris Keating"><a href="/webapp/name2record?mapID=Chris%20Keating"><span>Chris Keating</span></a></li>

from the brython

URLmapID = urllib.parse.quote(mapID)
mapID_href
= "/webapp/name2record?mapID="+URLmapID

mapID_link
= A(mapID, href=mapID_href)
mid
= "mid"+mapID

mapID_nav
= LI(mapID_link, id=mapID)

If you know your bootstrap, you know that this idiom is a series of blocks in the navigation column and when you click one of them, the browser is redirected to the new page. What I want to do is to transform the click instead into a brython call and run some code filling in a form.

The other idiom I'm looking for is one which goes through form and extracts all of the elements so I can stuff them into an Ajax call and deliver them to the backend.

Suggestions?

Reply all
Reply to author
Forward
0 new messages