Re: [web2py] How to change a form.vars.field value after validation?
Would you show you SQLFORM.factory code? Richard On Wed, Jun 27, 2012 at 4:14 PM, vinicius...@gmail.com vinicius...@gmail.com wrote: Hi guys. I'm facing a problem I didn't find a pure web2py solution. I have a SQLFORM.factory() with some fields, including one captcha field. Every time the form is showed, the input captcha field must be empty. The form may have error in other fields and the captcha could be filled right, but a new one is generated every time the form is showed. As password fields, the captcha must be always presented empty to the user. So, I tried to do form.vars.captcha = '' just before my return dict(form=form), but the value user filled in keeps showing. I also tried playing with form.request_vars.captcha but unsuccessfull again. I found a workaround hardcoding the INPUT tag in my view, instead of {{=form.custom.widget.captcha}**} as I usually do with other fields. Does anybody has any suggestion about it? How to change a form.vars.field value after validation? I think a custom validator would solve my problem. But I think it shouldn't be necessary in a so simple cenario. -- Vinicius Assef
Re: [web2py] How to change a form.vars.field value after validation?
Here it is: http://pastebin.com/2zMNYWnX On 06/27/2012 05:20 PM, Richard Vézina wrote: Would you show you SQLFORM.factory code? Richard On Wed, Jun 27, 2012 at 4:14 PM, vinicius...@gmail.com mailto:vinicius...@gmail.com vinicius...@gmail.com mailto:vinicius...@gmail.com wrote: Hi guys. I'm facing a problem I didn't find a pure web2py solution. I have a SQLFORM.factory() with some fields, including one captcha field. Every time the form is showed, the input captcha field must be empty. The form may have error in other fields and the captcha could be filled right, but a new one is generated every time the form is showed. As password fields, the captcha must be always presented empty to the user. So, I tried to do form.vars.captcha = '' just before my return dict(form=form), but the value user filled in keeps showing. I also tried playing with form.request_vars.captcha but unsuccessfull again. I found a workaround hardcoding the INPUT tag in my view, instead of {{=form.custom.widget.captcha}__} as I usually do with other fields. Does anybody has any suggestion about it? How to change a form.vars.field value after validation? I think a custom validator would solve my problem. But I think it shouldn't be necessary in a so simple cenario. -- Vinicius Assef
Re: [web2py] How to change a form.vars.field value after validation?
Wow, that is some strange code. What does your view code look like? How are you rendering the captcha widget?
Re: [web2py] How to change a form.vars.field value after validation?
Yes, I was rendering {{=form.custom.widget.captcha}} in my view. Why is this strange? On 06/27/2012 05:58 PM, pbreit wrote: Wow, that is some strange code. What does your view code look like? How are you rendering the captcha widget?
Re: [web2py] How to change a form.vars.field value after validation?
SO I think you have to inspect and edit the attributes of * form.custom.widget.captcha* * * after the .validate() check the attr's of form.custom.widget.captcha anc change them. *Bruno Cezar Rocha* http://www.CursoDePython.com.br [image: Facebook] http://facebook.com/rochacbruno [image: Twitter]http://twitter.com/rochacbruno [image: LinkedIn] http://linkedin.com/in/rochacbruno [image: about.me]http://about.me/rochacbruno [image: Amazon] http://amazon.com/author/rochacbruno [image: AngelList]http://angel.co/rochacbruno [image: Blog RSS] http://www.web2pyslices.com/slice/list.rss?author=1 [image: Facebook Page] http://facebook.com/CursoDePython [image: foursquare]http://foursquare.com/rochacbruno [image: Google Plus] https://plus.google.com/u/0/116110204708544946953/posts [image: pinterest] http://pinterest.com/rochacbruno [image: SlideShare]http://slideshare.com/rochacbruno [image: YouTube] http://youtube.com/user/brunovegan [image: Google Talk] rochacbruno [image: Skype] blouweb Blog: Generate a thumbnail that fits in a boxhttp://www.web2pyslices.com/slice/show/1522/generate-a-thumbnail-that-fits-in-a-box Get a signature like this. http://r1.wisestamp.com/r/landing?promo=18dest=http%3A%2F%2Fwww.wisestamp.com%2Femail-install%3Futm_source%3Dextension%26utm_medium%3Demail%26utm_campaign%3Dpromo_18 Click here.http://r1.wisestamp.com/r/landing?promo=18dest=http%3A%2F%2Fwww.wisestamp.com%2Femail-install%3Futm_source%3Dextension%26utm_medium%3Demail%26utm_campaign%3Dpromo_18 On Wed, Jun 27, 2012 at 6:51 PM, vinicius...@gmail.com vinicius...@gmail.com wrote: form.custom.widget.captcha