ฉันได้ตั้งค่าคีย์แล้วและสามารถทำให้ recaptcha แสดงบนหน้าเว็บได้ด้วยตัวเอง แต่ฉันไม่รู้ว่าจะทำให้มันอยู่ในแบบฟอร์มได้อย่างไร
จริงๆ แล้ว ฉันไม่ต้องการใช้รหัส เนื่องจากฉันจะใช้รหัสนี้ซ้ำในภายหลังภายในแอปด้วย ดังนั้นควรใช้ itemId มากกว่า ฉันคิดว่ายังไม่ได้สร้างองค์ประกอบดังกล่าว
รวมของฉัน: รหัส HTML:
<script type="text/javascript" src="http://www.google.com/recaptcha/api/js/recaptcha_ajax.js"></script>
ข้อผิดพลาด (สร้างจาก recaptcha_ajax.js ไม่สามารถรับการควบคุมด้วย id 'recaptcha'): Uncaught TypeError: ไม่สามารถตั้งค่าคุณสมบัติ 'innerHTML' เป็น null
นี่คือรหัส:
Ext.define('Login.view.Login', {
extend: 'Ext.form.Panel',
alias: 'widget.Login.view.Login',
border: false,
bodyPadding: 5,
initComponent: function() {
var config = {
layout: 'anchor',
defaultType: 'textfield',
defaults: {
anchor: '100%',
allowBlank: false
},
items: [{
fieldLabel: 'Company Id',
name: 'companyId'
},{
fieldLabel: 'Username',
name: 'username'
},{
fieldLabel: 'Password',
name: 'password',
inputType: 'password'
},{
/*xtype: 'panel',
itemId: 'reCaptcha',
border: false,*/
html: '<div id="recaptcha">adsf</div>'
}],
buttons: [{
text: 'Login'
}]
};
Ext.apply(this, config);
this.callParent();
},
afterRender: function() {
Recaptcha.create("heres_my_public_key",
document.getElementById('recaptcha'),
{
theme: "clean"/*,
callback: Recaptcha.focus_response_field*/
}
);
this.callParent();
}
});
มีใครทำสิ่งนี้โดยใช้ ExtJS 4 หรือไม่?
/K