python - Get value of div and other elements on button click -


i have html form consists of divs , ul element. want data on button click. know how when there input type element involved how deal div's , list elements?

html

  <div class="boxinner">      <form id="my_form" method="post">     <div class="inner-box-header">       %s     </div>     <div class="inner-sub-header">       %s     </div>      <div class="inner-box-footer">       <ul>         <li>             <img src="images/assets_icon_location.png" style="height:13px;width:10px;float:left;margin-right:3px;" alt="">             <span class="image-side-text">%s</span></li>             <li id="ip-location">&#9899<span>%s - %s</span></li>       </ul>     </div>      <div class="titlebox">       <input type="submit" value="click" name="ws_butt" />     </div>     </form>     </div> 

python script

request_body_size = int(environ.get('content_length', 0)) request_body = environ['wsgi.input'].read(request_body_size) d = parse_qs(request_body) 

how elements in request body , retrieve while parsing? there other way tackle this?

you cannot.

the body of post request contain values input elements, , not contain other information.

if must this, have 2 basic options:

  1. create actual form fields (best option); , style them accordingly.
  2. create hidden form fields, , using javascript add value of respected divs form field's value before form submitted.

as using post in example, make sure have mechanism stop csrf. easiest way use python framework.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -