[mod_python] radio buttons

John Raines jrraines at comcast.net
Tue Mar 28 10:58:56 EST 2006


  Your HTML looks something like this:
              <INPUT NAME="hysterect" Type="RADIO" Value="n">No<BR>
               <INPUT NAME="hysterect" Type="RADIO" Value="y">Yes<BR>
               <INPUT NAME="hysterect" Type="RADIO" Value="d">Don't  
Know'''
   #if you skip a radio item it doesn't get sent; if you skip a text  
field the key is sent with a null value.
  so you write something like "if answers.has_key("hysterect"):
                                                               
h=answers['hysterect']

The trick to figuring out these things is start with the minimum  
python form handler
def handleformx(req,**answers)
      return str(answers)

it'll show you exactly what got sent for various inputs or lack of  
filling things out etc.


On Mar 28, 2006, at 9:21 AM, Peter Sheldrick wrote:

> How must i tweak my python code so that mod_publisher successfully  
> understands radio buttons? atm i have two radio buttons that have  
> the same name="" attribute - but mod_publisher automatically maps  
> name attributes to  python variables; if there are two input forms  
> with the same name it gets confused. But this is compulsory for  
> radio buttons. Is there an easy way out?
>
> - Peter
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python



More information about the Mod_python mailing list