Fix #5622 - fix roojs dynamic example
[roojs1] / examples / form / dynamic.js
index ab2b266..0534df9 100644 (file)
@@ -11,6 +11,7 @@
  
 var mform;
 var simple;
+var signature;
 
 Roo.onReady(function(){
 
@@ -40,6 +41,8 @@ Roo.onReady(function(){
             width:175
         }),
 
+        
+        
         new Roo.form.TextField({
             fieldLabel: 'Company',
             name: 'company',
@@ -242,9 +245,43 @@ Roo.onReady(function(){
                         name: 'email',
                         vtype:'email',
                         width:225
+                    },
+                    
+                    {
+                        xtype : 'Select',
+                        fieldLabel: 'Country',
+                        name: 'scountry',
+                        //vtype:'email',
+                        width:225,
+                        valueField :'code',
+                        displayField  : 'title',
+                        emptyText : 'Select a country',
+                        store: {
+                             xtype : 'Store',
+                             xns: Roo.data,
+                             
+                             proxy: {
+                                 xns : Roo.data,
+                                 xtype : 'HttpProxy',
+                                 url: 'sample.data.json'
+                             },
+                             reader: {
+                                 xns : Roo.data,
+                                 xtype : 'JsonReader',
+                                 root: 'data',
+                                 totalProperty: 'totalCount',
+                                 id: 'post_id',
+                                 fields : [
+                                     'code', 'title'
+                                 ]
+                             }
+                         },
                     }
                 ]
-            },  
+            },
+            
+            
+            
             {
                   
                 xtype : 'Column', 
@@ -268,7 +305,7 @@ Roo.onReady(function(){
     mform.addButton('Save');
     mform.addButton('Cancel');
 
-   
+   /*
     mform.render('form-ct2');
     mform.setValues({
         country  : 'AK,LA',
@@ -276,6 +313,7 @@ Roo.onReady(function(){
         countrylist  : 'AG,AZ',
         countrylist_names : 'Antigua and Barbuda,Azerbaijan'        
     });
+    */
     /*
      * ================  Form 3  =======================
      */
@@ -470,6 +508,39 @@ Roo.onReady(function(){
         labelAlign: 'left',
         labelWidth: 120,
         items : [
+            {
+            
+                xtype: 'Checkbox',
+                xns : Roo.form,
+                fieldLabel: 'A checkbox',
+                boxLabel:'RooJS v1.1.1',
+                name:'extuser',
+                inputValue : '1',
+                value : '1',
+                width:'auto'
+            },
+            
+            {
+            
+                xtype: 'Radio',
+                xns : Roo.form,
+                fieldLabel: 'A test radio box',
+                boxLabel:'Test1',
+                name:'radiotest',
+                inputValue : '1',
+                width:'auto'
+            },
+              {
+            
+                xtype: 'Radio',
+                xns : Roo.form,
+                fieldLabel: 'A test radio box2',
+                boxLabel:'Test1',
+                name:'radiotest',
+                inputValue : '2',
+                checked: true,
+                width:'auto'
+            },
             {
             
                 xtype: 'Checkbox',
@@ -481,6 +552,8 @@ Roo.onReady(function(){
                 value : '1',
                 width:'auto'
             },
+            
+            
             {
                 xtype : 'DisplayField',
                 xns : Roo.form,
@@ -554,14 +627,22 @@ Roo.onReady(function(){
     /*
      * ================ form 7 =======================
      */
-    var form7 = new Roo.form.Form({
+    signature = new Roo.form.Form({
         labelWidth: 75, // label settings here cascade unless overridden
-        url:'save-form.php'
+        url:'save-form.php',
+        width: 500
     });
-    form7.add(
+    signature.add(
         new Roo.form.Signature({
             fieldLabel: 'Signature',
             name: 's',
+            listeners : {
+                confirm : function (_self)
+                {
+                    Roo.log(_self.getImageDataURI());
+                    Roo.log('in confirm');
+                }
+            },
             width: 300
         })
     );
@@ -569,7 +650,7 @@ Roo.onReady(function(){
 //    form7.addButton('Save');
 //    form7.addButton('Cancel');
 
-    form7.render('form-ct7');
+    signature.render('form-ct7');