2010-03-19 61 views
1

我不知道如何去使用样式如何自定义Recaptcha Widget使用Ambethia Ruby Gem?

http://github.com/ambethia/recaptcha

我想调整的窗口小部件,以适应在侧边栏的表单自定义主题reCAPTCHA小工具。

如果我

<%= recaptcha_tags :display => {:theme => 'custom', :custom_theme_widget => 'recaptcha_widget'} %> 

,并添加作为每

<div id="recaptcha_widget"> 
    <div id="recaptcha_image"></div> 
    <input type="text" id="recaptcha_response_field" name="recaptcha_response_field" /> 
</div> 

Recaptcha - Form Customization

我只得到响应输入字段,并且在源属性的错误消息的img标签

SRC =“http://optim.coral.cs.cmu.edu/error/TypeError_Result_of_expression_____recaptcha_response_field_____null__is_not_an_object_”

有没有人发现自定义主题的好办法使用Ambethia宝石reCAPTCHA小工具?

回答

0

我做到了,这样没有helpers..it工作,如果我通过了脚本标签的公钥,但不是在environment.rb中:

#recaptcha_container 
     %label{ :for => "recaptcha_response_field" } 
     Enter the two words below: 
     %input#recaptcha_response_field.text{ :name => "recaptcha_response_field", :type => "text" } 
     #recaptcha_image 
     %p 
     Choose captcha format: 
     %a{ :href => "javascript:Recaptcha.switch_type('image');" } 
      Image 
     or 
     %a{ :href => "javascript:Recaptcha.switch_type('audio');" } 
      Audio 
     %input#recaptcha_reload_btn{ :type => "button", :value => "Get new words", :onclick => "Recaptcha.reload();" } 
    %script{ :src => "http://api.recaptcha.net/challenge?k=INSERT_KEY_HERE", :type => "text/javascript" } 
    %noscript 
     %iframe{ :src => "http://api.recaptcha.net/noscript?k=INSERT_KEY_HERE" } 
     height="300" width="500" frameborder="0"> 
     %textarea{ :name => "recaptcha_challenge_field", :rows => "3", :cols => "40" } 
0

我有同样的问题。 但是,如果您在recaptcha_tags之前放置了recaptcha_widget的html代码,则一切正常。