Re: [tornado] Radio buttons and get_argument()

248 views
Skip to first unread message

Aleksey Silk

unread,
Jun 12, 2013, 2:58:11 PM6/12/13
to python-...@googlegroups.com
<input type="radio" name="group1" value="Milk"> Milk<br>
<input type="radio" name="group1" value="Butter" checked> Butter<br>
<input type="radio" name="group1" value="Cheese"> Cheese
<hr>
<input type="radio" name="group2" value="Water"> Water<br>
<input type="radio" name="group2" value="Beer"> Beer<br>
<input type="radio" name="group2" value="Wine" checked> 

self.get_argument('group1')
self.get_argument('group2')

You should get checked argument value.


С уважением, Алексей Силк
With best regards, Aleksey Silk
 
skype - rootiks
 


2013/6/12 Ian Whitlock <i...@theknown.net>
I've built an HTML form with some radio buttons. The radio buttons have to share the same name in order to appear in a 'group' in HTML.
From inside of my RequestHandler, I am trying to determine which radio button has been clicked. However, when I do get_argument('radio') it just returns 'on', and get_arguments('radio') returns simply ['on']. get_argument() also doesn't appear to work with the individual radio button IDs and the whole of self.request seems to lack the information encoded in the form. Is this a bug or am I doing it wrong?

Ian

--
You received this message because you are subscribed to the Google Groups "Tornado Web Server" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-tornad...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ian Whitlock

unread,
Jun 12, 2013, 3:04:35 PM6/12/13
to python-...@googlegroups.com
Oh! I'm stupid, I didn't put a value= flag in my HTML, so Tornado didn't know what to respond with! Duhhh!

Thank you so much! :)

Ian

Aleksey Silk

unread,
Jun 12, 2013, 3:10:48 PM6/12/13
to python-...@googlegroups.com
:)
Reply all
Reply to author
Forward
0 new messages