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/
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thursday 19 April 2001 11:29, Miha wrote: Hi, see the HowTo "Form Variable Types and Typechecking" You can give extented attributes to form fields that will be handled by zope. It's briefly explained in the mentioned howto. The howto can be found on zope.org
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/
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
- -- Uwe C. Schr�der - -- Uwe C. Schr�der ConTrada Consultants Lindenstrasse 15 Tel/Fax: +49 8294 80070 D-86477 Adelsried Mobil: +49 172 8532352 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.4 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE63vHwTJbO78VG0aIRApWgAJoDfD3Pu3s+3IiZZLsCDzFEirCV8QCfXG18 4fPBOSnSx1tbxH6VhB/nH2w= =QdoI -----END PGP SIGNATURE-----
You have two things to deal with. 1) You are using a checkbox for the "favorite" input element. When a checkbox is not checked, it does not return a variable of that name in the form. 2) You have more than one checkbox with the name "favorite". If more than one are checked, the form will return a list containing all the values. Furthermore, if only one is checked, the form will return a single string, not a list. This would require further testing and handling. You can make the form always return a list by changing the name of the input to "favorite:list". You would still refer to the variable as "favorite". Both possiblities will cause errors for your insert statement. First, you need to decide whether you really want to allow more than one "favorite" value. If you do, you need to figure out how they should be represented in the database. Then you need to loop through the values. If you decide you only want one value, you can change to using radio buttons. One button could have the value '' (the empty string), and the lable "No Favorite". This way, you would always get a single string in the form data, although it might be an empty string. Your insert code would work correctly. Cheers, Tom P Miha" <Miha@instock.ru> asked -
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)
Hello Thomas, Your words are right, but that isn't context depended problem. Here I can find simple solution, but in other keys? Big thanks for you attention. - M. (mailto:Miha@instock.ru) Developer. http://www.instock.ru/ Thursday, April 19, 2001, 6:36:38 PM, you wrote: From: Thomas B. Passin <tpassin@mitretek.org> To: "Zope-list" <zope@zope.org> Date: Thursday, April 19, 2001, 6:36:38 PM Subject: [Zope] absent variables TBP> You have two things to deal with. TBP> 1) You are using a checkbox for the "favorite" input element. When a TBP> checkbox is not checked, it does not return a variable of that name in the TBP> form. TBP> 2) You have more than one checkbox with the name "favorite". If more than TBP> one are checked, the form will return a list containing all the values. TBP> Furthermore, if only one is checked, the form will return a single string, TBP> not a list. This would require further testing and handling. You can make TBP> the form always return a list by changing the name of the input to TBP> "favorite:list". You would still refer to the variable as "favorite". TBP> Both possiblities will cause errors for your insert statement. TBP> First, you need to decide whether you really want to allow more than one TBP> "favorite" value. If you do, you need to figure out how they should be TBP> represented in the database. Then you need to loop through the values. TBP> If you decide you only want one value, you can change to using radio TBP> buttons. One button could have the value '' (the empty string), and the TBP> lable "No Favorite". This way, you would always get a single string in the TBP> form data, although it might be an empty string. Your insert code would TBP> work correctly. TBP> Cheers, TBP> Tom P TBP> Miha" <Miha@instock.ru> asked -
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)
TBP> _______________________________________________ TBP> Zope maillist - Zope@zope.org TBP> http://lists.zope.org/mailman/listinfo/zope TBP> ** No cross posts or HTML encoding! ** TBP> (Related lists - TBP> http://lists.zope.org/mailman/listinfo/zope-announce TBP> http://lists.zope.org/mailman/listinfo/zope-dev )
Miha, I don't know what you are asking for. What do you want a solution for? There isn't one answer for all problems. Tom P Miha wrote -
Hello Thomas,
Your words are right, but that isn't context depended problem. Here I can find simple solution, but in other keys? Big thanks for you attention.
...
TBP> 1) You are using a checkbox for the "favorite" input element. When a TBP> checkbox is not checked, it does not return a variable of that name in the TBP> form.
TBP> 2) You have more than one checkbox with the name "favorite". If more than TBP> one are checked, the form will return a list containing all the values. TBP> Furthermore, if only one is checked, the form will return a single string, TBP> not a list. This would require further testing and handling. You can make TBP> the form always return a list by changing the name of the input to TBP> "favorite:list". You would still refer to the variable as "favorite".
TBP> Both possiblities will cause errors for your insert statement.
TBP> First, you need to decide whether you really want to allow more than one TBP> "favorite" value. If you do, you need to figure out how they should be TBP> represented in the database. Then you need to loop through the values.
TBP> If you decide you only want one value, you can change to using radio TBP> buttons. One button could have the value '' (the empty string), and the TBP> lable "No Favorite". This way, you would always get a single string in the TBP> form data, although it might be an empty string. Your insert code would TBP> work correctly.
participants (3)
-
Miha -
Thomas B. Passin -
Uwe C. Schroeder