Graham Dumpleton
grahamd at dscpl.com.au
Sat Aug 27 02:26:28 EDT 2005
You are probably correct. If I change the "action" to point at my own form input testing page: http://www.dscpl.com.au/projects/vampire/examples/templates/ form_values.html and don't change anything, I get back: Form Values Name Value address1 leave the above blank address2 leave all checkboxes blank job_title So yes, "products" doesn't display if there is nothing selected. This though appears to be because the browser doesn't send it, not that mod_python ignores it. You can see this if you use a GET request and set "action" to: http://www.dscpl.com.au/projects/vampire/examples/templates/ request_details.html Note how "products" isn't even encoded into the URL. Looks like your handler is going to have to explicitly handle that case. This would not generally be a problem if using a scheme which mapped form arguments to actual function arguments like in publisher or Vampire as you could specify a default value of None for products and use that this pick up that it wasn't set at all. Graham On 27/08/2005, at 3:59 PM, Scott Chapman wrote: > 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"> </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 & > 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 >
|