Get Select option value and send it to a python module! how ?

133 views
Skip to first unread message

Prabhakaran Kasinathan

unread,
Sep 27, 2013, 12:13:00 PM9/27/13
to gen...@googlegroups.com
Hi everyone,

This question could be very simple, but I am new to this.


I have a test.xml where I have this following select option. I need to send the selected value to a python module change_value

test.xml
..
..

<?python
  data = ""
?>
..
.
<form method="POST" action="/change_value/$data/${tspec.id}">
        Select the value #
          <select id="channel" title="Select the channel">
          <option value="11">11</option>
          <option value="12">12</option>
        </select>   
<input type="submit" value="change_channel"  />
</form>   
Channel changed to: $data    
--

<!--    I can use the java script attribute to access : document.getElementById('channel').value);" /> , but i dont know how to update $data value using javascript attribute.-->

But I need to send this value to the function change_value/$data ( where this data should be updated ).. How do access the value from the select option value and send that value to the any python function which is written in controller.py. ?

This could be a very basic question, but i need some help. Thanks. 


Simon Cross

unread,
Sep 27, 2013, 12:28:01 PM9/27/13
to gen...@googlegroups.com
Hi!

You can't modify template variables from Javascript. Javascript only
has accessed to the rendered template which no longer has any
variables (the rendered template is just HTML).

Schiavo
Simon
Reply all
Reply to author
Forward
0 new messages