2016-12-28 31 views
0

我正在使用Google Re-Captcha,並希望在重新輸入驗證碼後啓用提交按鈕。 我想一個回調函數添加到div類我的代碼看起來是這樣的:Django - 手動表單字段呈現添加類

<div class="input-field col s12"> 
    {{ form.captcha.errors }} 
     <div data-callback="enableBtn"></div> 
    {{ form.captcha }} 
</div> 

這目前返回form.captcha以外的數據回調。我如何將data-callback屬性添加到form.captcha?

所以爲前: 如果form.captcha是

<div class="g-recaptcha" data-sitekey="== xxxxxx =="></div> 

,而不必

<div class="g-recaptcha" data-sitekey="== xxxxxx ==" data-callback="enableBtn"> 

<div data-callback="enableBtn"> 
<div class="g-recaptcha" data-sitekey="== xxxxxx =="></div> 
+0

你是什麼意思除了功能?是否調用了'enableBtn'函數? –

+0

@RajaSimon我的錯誤,我的意思是在form.captcha之外!我將更新以進一步解釋 – Juanvulcano

+0

@RajaSimon我想在重新驗證碼完成後啓用提交按鈕。所以一旦完成enableBtn函數get的所謂的 – Juanvulcano

回答

1

您可以指定窗口小部件網址...

NORECAPTCHA_WIDGET_TEMPLATE (string) = location for the widget template. 

請參閱此html並使它像一個並放置在您的模板並指出它。