[Zope] absent variables

Miha Miha <Miha@instock.ru>
Thu, 19 Apr 2001 13:29:16 +0400


Hello all in,

   I meet problem, may be somebody can help me. I try to send results
   of filled form thought dtml-method (proxy of course), but user can
   don't fill some input values. When I submit form with unchecked
   checkbox (name favorite) I receive error:
          Error Type: Bad Request
          Error Value: ['favorite']

   How i can create default values for favorite?
   My SQL query for ZGadFlyDB:
         create TABLE REPORTS ( COUNTRY VARCHAR, REGION VARCHAR,
                                TOWN VARCHAR,    NAME VARCHAR,
                                ADRESS VARCHAR,  EMAIL VARCHAR,
                                TEL VARCHAR,     FAVORITE VARCHAR)

                                
   My code:
---[FORM::DTML-Document
<form name="startNewLife" method="post" action="reportAction">
  Country <input type="text" name="country" value="Russia">
  Region <input type="text" name="region">
  Town <input type="text" name="town">
  Name <input type="text" name="name">
  Address <input type="text" name="adress">
  e-mail <input type="text" name="email">
  Tel <input type="text" name="tel" value="+7(   )">
  Favorites <input type="checkbox" name="favorite" value="var1"> var1
  <br>
  <input type="checkbox" name="favorite" value="var2"> var2<br>
  <input type="checkbox" name="favorite" value="var3"> var3<br>
  <hr>
  <input type="submit" value="Snd">
   <input type="reset" value="Rst">
</form>
---[/FORM

---[insert::Z SQL Method
Arguments:

country
region
town
name
adress
email
tel
favorite

Body:

insert into REPORTS
  values(
<dtml-sqlvar country type="string">,
<dtml-sqlvar region type="string">,
<dtml-sqlvar town type="string">,
<dtml-sqlvar name type="string">,
<dtml-sqlvar adress type="string">,
<dtml-sqlvar email type="string">,
<dtml-sqlvar tel type="string">,
<dtml-sqlvar favorite type="string">)
---[/insert

---[reportAction::DTML Document::Proxy(Manager)
<dtml-call insert>
<h3>Thx!</h3>
---[/reportAction


Big thanks
-
M. (mailto:Miha@instock.ru)
Developer. 
http://www.instock.ru/