[mod_python] Blank form values are not showing up in my mod_pyton/mpservlets environments

Scott Chapman scott_list at mischko.com
Sat Aug 27 01:59:54 EDT 2005


Graham,
It appears that the keep_blank_values toggle does not turn on checkbox inputs 
that are empty?  It  retains intput text but so far not checkboxes. :(

Can you run a quick test of this and tell me if I'm going insane or not?

Save this locally then load it in your browser and submit it just like it is:

<html><head></head><body>
<form name="user_form" id="user_form" class="marginForm" method="GET" 
action="http://www.mischko.com/test">
   <fieldset>
     <legend>User Information</legend>

     <label id="l_job_title" for="job_title">Job Title</label>
     <input id="job_title" name="job_title" size="30" type="text" value=""/><br/>
     <label class="required" id="l_address1" for="address1">Address</label>
     <input id="address1" name="address1" size="30" type="text" value="leave the 
above blank"/><br/>
     <label id="l_address2" for="address2">&nbsp;</label>
     <input id="address2" name="address2" size="30" type="text" value="leave all 
checkboxes blank"/><br/>
   </fieldset>

   <fieldset class="radio">
     <legend>Products Offered</legend>

     <input id="products1" name="products" value="Seed" type="checkbox"/>
     <label id="l_products1" for="products1">Seed</label><br/>
     <input id="products2" name="products" value="Seed Mixes" type="checkbox"/>
     <label id="l_products2" for="products2">Seed Mixes</label><br/>
     <input id="products3" name="products" value="Certified Seed" type="checkbox"/>
     <label id="l_products3" for="products3">Certified Seed</label><br/>
     <input id="products4" name="products" value="Plants" type="checkbox"/>
     <label id="l_products4" for="products4">Plants</label><br/>
     <input id="products5" name="products" value="Equipment &amp; Supplies" 
type="checkbox"/>
     <label id="l_products5" for="products5">Equipment & Supplies</label><br/>
   </fieldset>

   <input id="submit_user_form" class="submit" value="Submit" type="submit"/><br/>
</form></body></html>

You'll see that products does not show up in the GET URL or the test page.
Scott

Graham Dumpleton wrote:
> 
> On 27/08/2005, at 1:19 PM, Scott Chapman wrote:
> 
>> Can anyone shed any light on why blank form elements are not showing 
>> up in mod_python?
> 
> 
> Would this help:
> 
>   form = util.FieldStorage(req,keep_blank_values=1)
> 
> See documentation:
> 
>    http://www.modpython.org/live/current/doc-html/pyapi-util-fstor.html
> 
> Graham



More information about the Mod_python mailing list