We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 46073
    • 65 Posts
    I have a simple Radio button filed taht does not seem to want to render in the grid editor. I can get a dropdown listbox to display but it's options are blank. Please advise.

    Form Tabs (partial):
    {"field":"align","caption":"Caption Alignment","description":"Default: Left","inputTVtype":"option","inputOptionValues":"Left||Right","default":"Left"}


    Grid Columns (partial):
    {"header": "Caption Alignment", "width": "250", "sortable": "true", "dataIndex": "align","editor":"this.listboxEditor"}
      • 4172
      • 5,888 Posts
      did you try
      "inputTVtype":"listbox"
      ?
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 46073
        • 65 Posts
        Quote from: Bruno17 at Jul 25, 2017, 04:27 PM
        did you try
        "inputTVtype":"listbox"
        ?

        Yes, I've tried listbox, checkbox, and option (radio) none of them work.

        This is what it looks like when I try to edit the field.
        [ed. note: rgliberty last edited this post 6 years, 9 months ago.]
          • 51216
          • 35 Posts
          Having the same problem.

          Here's my code:

          Form Tabs
          [
          {"caption":"Entry", "fields": [
              {"field":"name","caption":"Name","inputTVtype":"text"},
              {"field":"description","caption":"Description","inputTVtype":"richtext"},
              {"field":"image","caption":"Image","inputTV":"mixedImageTv"},
              {"field":"published","caption":"Published","inputTVtype":"listbox", "inputOptionValues":"Yes||No", "default":"Yes"}
          ]}
          ]
          


          Grid Columns
          [
          {"header": "Name", "width": "50", "sortable": "true", "dataIndex": "name", "editor": "this.textEditor"},
          {"header": "Description", "width": "50", "sortable": "true", "dataIndex": "description"},
          {"header": "Image", "width": "50", "sortable": "true", "dataIndex": "image","renderer": "this.renderImage"},
          {"header": "Published", "width": "50", "dataIndex": "published", "editor": "this.listboxEditor"}
          ]
          


          I also tried inputTV using my own TV.

          Any suggestions?

          Edit: Using MIGX 2.11.0-pl
            • 26503
            • 620 Posts
            I am having the same problem as well - I can get the list box to display in the form, but it shows up blank in the grid. How do I populate that with options so users can select them?

            Here is the field (works)

            {
                      "MIGX_id":155,
                      "field":"category",
                      "caption":"Project Category",
                      "description":"",
                      "description_is_code":"0",
                      "inputTV":"",
                      "inputTVtype":"listbox",
                      "validation":"required",
                      "configs":"\n",
                      "restrictive_condition":"",
                      "display":"",
                      "sourceFrom":"config",
                      "sources":"",
                      "inputOptionValues":"@EVAL return '--- Choose Category ---==||' . $modx->runSnippet('migxLoopCollection',array('packageName'=>'projects','classname'=>'ProjectCategory','tpl'=>'@CODE:[[+category]]==[[+id]]','outputSeparator'=>'||'));",
                      "default":"",
                      "useDefaultIfEmpty":"0",
                      "pos":2
                    },


            and the column (does not work)

            {
                  "MIGX_id":6,
                  "header":"Category",
                  "dataIndex":"ProjectCategory_category",
                  "width":"",
                  "sortable":1,
                  "show_in_grid":1,
                  "customrenderer":"",
                  "renderer":"",
                  "clickaction":"switchOption",
                  "selectorconfig":"",
                  "renderchunktpl":"",
                  "renderoptions":"",
                  "editor":"this.listboxEditor"
                },




            and the extended stuff:

            "extended":{
                "migx_add":"Add New Project",
                "disable_add_item":"",
                "add_items_directly":"",
                "formcaption":"",
                "update_win_title":"",
                "win_id":"proj",
                "maxRecords":"",
                "addNewItemAt":"bottom",
                "media_source_id":"",
                "multiple_formtabs":"",
                "multiple_formtabs_label":"",
                "multiple_formtabs_field":"",
                "multiple_formtabs_optionstext":"",
                "multiple_formtabs_optionsvalue":"",
                "actionbuttonsperrow":4,
                "winbuttonslist":"cancel||done",
                "extrahandlers":"this.toggleDeleted||this.handleColumnSwitch",
                "filtersperrow":4,
                "packageName":"projects",
                "classname":"Project",
                "task":"",
                "getlistsort":"",
                "getlistsortdir":"",
                "sortconfig":"",
                "gridpagesize":50,
                "use_custom_prefix":"0",
                "prefix":"",
                "grid":"",
                "gridload_mode":2,
                "check_resid":"0",
                "check_resid_TV":"",
                "join_alias":"",
                "has_jointable":"no",
                "getlistwhere":"",
                "joins":[
                  {
                    "alias":"ProjectDocument"
                  },
                  {
                    "alias":"ProjectImage"
                  },
                  {
                    "alias":"ProjectCategory"
                  },
                  {
                    "alias":"ProjectStatus"
                  }
                ],
                "hooksnippets":"",
                "cmpmaincaption":"",
                "cmptabcaption":"",
                "cmptabdescription":"",
                "cmptabcontroller":"",
                "winbuttons":"",
                "onsubmitsuccess":"",
                "submitparams":""
              },
              *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

              Sean Kimball CLP, CLS.
              Technical Director / Sr. Developer | BigBlock Studios
              ._______________________________________________.
              Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
              27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
              phone/fax: 905-426-5525
              • 26503
              • 620 Posts
              Here are the changes I made to get this to work.

              {
                "formtabs":[
                  {
                    "MIGX_id":39,
                    "caption":"Project Details",
                    "print_before_tabs":"0",
                    "fields":[
                      {
                        "MIGX_id":152,
                        "field":"title",
                        "caption":"Project Title",
                        "description":"",
                        "description_is_code":"0",
                        "inputTV":"",
                        "inputTVtype":"",
                        "validation":"required",
                        "configs":"",
                        "restrictive_condition":"",
                        "display":"",
                        "sourceFrom":"config",
                        "sources":"",
                        "inputOptionValues":"",
                        "default":"",
                        "useDefaultIfEmpty":"0",
                        "pos":1
                      },
                      {
                        "MIGX_id":155,
                        "field":"category",
                        "caption":"Project Category",
                        "description":"",
                        "description_is_code":"0",
                        "inputTV":"",
                        "inputTVtype":"listbox",
                        "validation":"required",
                        "configs":"\n",
                        "restrictive_condition":"",
                        "display":"",
                        "sourceFrom":"config",
                        "sources":"",
                        "inputOptionValues":"@EVAL return '--- Choose Category ---==||' . $modx->runSnippet('migxLoopCollection',array('packageName'=>'projects','classname'=>'ProjectCategory','tpl'=>'@CODE:[[+category]]==[[+id]]','outputSeparator'=>'||'));",
                        "default":"",
                        "useDefaultIfEmpty":"0",
                        "pos":2
                      },
                      {
                        "MIGX_id":156,
                        "field":"status",
                        "caption":"Project Status",
                        "description":"",
                        "description_is_code":"0",
                        "inputTV":"",
                        "inputTVtype":"listbox",
                        "validation":"required",
                        "configs":"",
                        "restrictive_condition":"",
                        "display":"",
                        "sourceFrom":"config",
                        "sources":"",
                        "inputOptionValues":"@EVAL return '--- Choose Status ---==||' . $modx->runSnippet('migxLoopCollection',array('packageName'=>'projects','classname'=>'ProjectStatus','tpl'=>'@CODE:[[+status]]==[[+id]]','outputSeparator'=>'||'));",
                        "default":"",
                        "useDefaultIfEmpty":"0",
                        "pos":3
                      },
                      {
                        "MIGX_id":153,
                        "field":"tenderdate",
                        "caption":"Tender Date",
                        "description":"",
                        "description_is_code":"0",
                        "inputTV":"",
                        "inputTVtype":"date",
                        "validation":"required",
                        "configs":"",
                        "restrictive_condition":"",
                        "display":"",
                        "sourceFrom":"config",
                        "sources":"",
                        "inputOptionValues":"",
                        "default":"",
                        "useDefaultIfEmpty":"0",
                        "pos":4
                      },
                      {
                        "MIGX_id":157,
                        "field":"sqfoot",
                        "caption":"Square Feet",
                        "description":"",
                        "description_is_code":"0",
                        "inputTV":"",
                        "inputTVtype":"",
                        "validation":"required",
                        "configs":"",
                        "restrictive_condition":"",
                        "display":"",
                        "sourceFrom":"config",
                        "sources":"",
                        "inputOptionValues":"",
                        "default":"",
                        "useDefaultIfEmpty":"0",
                        "pos":5
                      },
                      {
                        "MIGX_id":154,
                        "field":"description",
                        "caption":"Description",
                        "description":"",
                        "description_is_code":"0",
                        "inputTV":"",
                        "inputTVtype":"textarea",
                        "validation":"required",
                        "configs":"",
                        "restrictive_condition":"",
                        "display":"",
                        "sourceFrom":"config",
                        "sources":"",
                        "inputOptionValues":"",
                        "default":"",
                        "useDefaultIfEmpty":"0",
                        "pos":6
                      },
                      {
                        "MIGX_id":159,
                        "field":"published",
                        "caption":"Published",
                        "description":"",
                        "description_is_code":"0",
                        "inputTV":"",
                        "inputTVtype":"checkbox",
                        "validation":"",
                        "configs":"",
                        "restrictive_condition":"",
                        "display":"",
                        "sourceFrom":"config",
                        "sources":"",
                        "inputOptionValues":"yes==1||no==0",
                        "default":1,
                        "useDefaultIfEmpty":1,
                        "pos":7
                      },
                      {
                        "MIGX_id":160,
                        "field":"featured",
                        "caption":"Project is featured",
                        "description":"",
                        "description_is_code":"0",
                        "inputTV":"",
                        "inputTVtype":"checkbox",
                        "validation":"",
                        "configs":"",
                        "restrictive_condition":"",
                        "display":"",
                        "sourceFrom":"config",
                        "sources":"",
                        "inputOptionValues":"yes==1||no==0",
                        "default":"0",
                        "useDefaultIfEmpty":"0",
                        "pos":8
                      },
                      {
                        "MIGX_id":220,
                        "field":"deleted",
                        "caption":"Deleted",
                        "description":"",
                        "description_is_code":"0",
                        "inputTV":"",
                        "inputTVtype":"checkbox",
                        "validation":"",
                        "configs":"",
                        "restrictive_condition":"",
                        "display":"",
                        "sourceFrom":"config",
                        "sources":"",
                        "inputOptionValues":"yes==1||no==0",
                        "default":"0",
                        "useDefaultIfEmpty":1,
                        "pos":9
                      }
                    ],
                    "pos":1
                  },
                  {
                    "MIGX_id":40,
                    "caption":"Project Documents",
                    "print_before_tabs":"0",
                    "fields":[
                      {
                        "MIGX_id":161,
                        "field":"",
                        "caption":"Documents",
                        "description":"",
                        "description_is_code":"0",
                        "inputTV":"",
                        "inputTVtype":"migxdb",
                        "validation":"",
                        "configs":"Documents",
                        "restrictive_condition":"",
                        "display":"",
                        "sourceFrom":"config",
                        "sources":[
                          {
                            "MIGX_id":1,
                            "context":"web",
                            "sourceid":4
                          },
                          {
                            "MIGX_id":2,
                            "context":"mgr",
                            "sourceid":4
                          }
                        ],
                        "inputOptionValues":"",
                        "default":"",
                        "useDefaultIfEmpty":"0",
                        "pos":1
                      }
                    ],
                    "pos":2
                  },
                  {
                    "MIGX_id":49,
                    "caption":"Project Images",
                    "print_before_tabs":"0",
                    "fields":[
                      {
                        "MIGX_id":197,
                        "field":"",
                        "caption":"Images",
                        "description":"",
                        "description_is_code":"0",
                        "inputTV":"",
                        "inputTVtype":"migxdb",
                        "validation":"",
                        "configs":"Images",
                        "restrictive_condition":"",
                        "display":"",
                        "sourceFrom":"config",
                        "sources":[
                          {
                            "MIGX_id":1,
                            "context":"mgr",
                            "sourceid":3
                          },
                          {
                            "MIGX_id":2,
                            "context":"web",
                            "sourceid":3
                          }
                        ],
                        "inputOptionValues":"",
                        "default":"",
                        "useDefaultIfEmpty":"0",
                        "pos":1
                      }
                    ],
                    "pos":3
                  }
                ],
                "contextmenus":"update||duplicate||remove",
                "actionbuttons":"addItem||toggletrash",
                "columnbuttons":"",
                "filters":"",
                "extended":{
                  "migx_add":"Add New Project",
                  "disable_add_item":"",
                  "add_items_directly":"",
                  "formcaption":"",
                  "update_win_title":"",
                  "win_id":"proj",
                  "maxRecords":"",
                  "addNewItemAt":"bottom",
                  "media_source_id":"",
                  "multiple_formtabs":"",
                  "multiple_formtabs_label":"",
                  "multiple_formtabs_field":"",
                  "multiple_formtabs_optionstext":"",
                  "multiple_formtabs_optionsvalue":"",
                  "actionbuttonsperrow":4,
                  "winbuttonslist":"cancel||done",
                  "extrahandlers":"this.toggleDeleted||this.handleColumnSwitch",
                  "filtersperrow":4,
                  "packageName":"projects",
                  "classname":"Project",
                  "task":"",
                  "getlistsort":"",
                  "getlistsortdir":"",
                  "sortconfig":"",
                  "gridpagesize":50,
                  "use_custom_prefix":"0",
                  "prefix":"",
                  "grid":"",
                  "gridload_mode":2,
                  "check_resid":"0",
                  "check_resid_TV":"",
                  "join_alias":"",
                  "has_jointable":"no",
                  "getlistwhere":"",
                  "joins":[
                    {
                      "alias":"ProjectDocument"
                    },
                    {
                      "alias":"ProjectImage"
                    },
                    {
                      "alias":"ProjectCategory"
                    },
                    {
                      "alias":"ProjectStatus"
                    }
                  ],
                  "hooksnippets":"",
                  "cmpmaincaption":"",
                  "cmptabcaption":"",
                  "cmptabdescription":"",
                  "cmptabcontroller":"",
                  "winbuttons":"",
                  "onsubmitsuccess":"",
                  "submitparams":""
                },
                "columns":[
                  {
                    "MIGX_id":2,
                    "header":"id",
                    "dataIndex":"id",
                    "width":25,
                    "sortable":true,
                    "show_in_grid":1,
                    "customrenderer":"",
                    "renderer":"",
                    "clickaction":"",
                    "selectorconfig":"",
                    "renderchunktpl":"",
                    "renderoptions":"",
                    "editor":""
                  },
                  {
                    "MIGX_id":3,
                    "header":"Project",
                    "dataIndex":"title",
                    "width":"",
                    "sortable":true,
                    "show_in_grid":1,
                    "customrenderer":"",
                    "renderer":"",
                    "clickaction":"",
                    "selectorconfig":"",
                    "renderchunktpl":"",
                    "renderoptions":"",
                    "editor":"this.textEditor"
                  },
                  {
                    "MIGX_id":6,
                    "header":"Category",
                    "dataIndex":"category",
                    "width":"",
                    "sortable":true,
                    "show_in_grid":1,
                    "customrenderer":"",
                    "renderer":"this.renderChunk",
                    "clickaction":"switchOption",
                    "selectorconfig":"",
                    "renderchunktpl":"[[!projects? &function=`getListBoxOption` &alias=`ProjectCategory` &object_id=`[[+ProjectCategory_id]]` &return_column=`category`]]",
                    "renderoptions":"",
                    "editor":"this.listboxEditor"
                  },
                  {
                    "MIGX_id":7,
                    "header":"Project Status",
                    "dataIndex":"status",
                    "width":"",
                    "sortable":true,
                    "show_in_grid":1,
                    "customrenderer":"",
                    "renderer":"this.renderChunk",
                    "clickaction":"switchOption",
                    "selectorconfig":"",
                    "renderchunktpl":"[[!projects? &function=`getListBoxOption` &alias=`ProjectStatus` &object_id=`[[+ProjectStatus_id]]` &return_column=`status`]]",
                    "renderoptions":"",
                    "editor":"this.listboxEditor"
                  },
                  {
                    "MIGX_id":4,
                    "header":"Tender Date",
                    "dataIndex":"tenderdate",
                    "width":"",
                    "sortable":true,
                    "show_in_grid":1,
                    "customrenderer":"",
                    "renderer":"this.renderDate",
                    "clickaction":"",
                    "selectorconfig":"",
                    "renderchunktpl":"",
                    "renderoptions":"",
                    "editor":""
                  },
                  {
                    "MIGX_id":8,
                    "header":"Square Feet",
                    "dataIndex":"sqfoot",
                    "width":"",
                    "sortable":true,
                    "show_in_grid":1,
                    "customrenderer":"",
                    "renderer":"",
                    "clickaction":"",
                    "selectorconfig":"",
                    "renderchunktpl":"",
                    "renderoptions":"",
                    "editor":""
                  },
                  {
                    "MIGX_id":11,
                    "header":"Featured",
                    "dataIndex":"featured",
                    "width":50,
                    "sortable":true,
                    "show_in_grid":1,
                    "customrenderer":"",
                    "renderer":"this.renderSwitchStatusOptions",
                    "clickaction":"switchOption",
                    "selectorconfig":"",
                    "renderchunktpl":"",
                    "renderoptions":[
                      {
                        "MIGX_id":1,
                        "name":"published",
                        "use_as_fallback":1,
                        "value":1,
                        "clickaction":"switchOption",
                        "handler":"",
                        "image":"assets\/components\/migx\/style\/images\/tick.png"
                      },
                      {
                        "MIGX_id":2,
                        "name":"published",
                        "use_as_fallback":"",
                        "value":1,
                        "clickaction":"switchOption",
                        "handler":"",
                        "image":"assets\/components\/migx\/style\/images\/tick.png"
                      },
                      {
                        "MIGX_id":3,
                        "name":"unpublished",
                        "use_as_fallback":"",
                        "value":"0",
                        "clickaction":"switchOption",
                        "handler":"",
                        "image":"assets\/components\/migx\/style\/images\/cross.png"
                      }
                    ],
                    "editor":""
                  },
                  {
                    "MIGX_id":9,
                    "header":"Deleted",
                    "dataIndex":"deleted",
                    "width":50,
                    "sortable":true,
                    "show_in_grid":1,
                    "customrenderer":"",
                    "renderer":"this.renderSwitchStatusOptions",
                    "clickaction":"switchOption",
                    "selectorconfig":"",
                    "renderchunktpl":"",
                    "renderoptions":[
                      {
                        "MIGX_id":1,
                        "name":"published",
                        "use_as_fallback":1,
                        "value":1,
                        "clickaction":"switchOption",
                        "handler":"",
                        "image":"assets\/components\/migx\/style\/images\/tick.png"
                      },
                      {
                        "MIGX_id":2,
                        "name":"published",
                        "use_as_fallback":"",
                        "value":1,
                        "clickaction":"switchOption",
                        "handler":"",
                        "image":"assets\/components\/migx\/style\/images\/tick.png"
                      },
                      {
                        "MIGX_id":3,
                        "name":"unpublished",
                        "use_as_fallback":"",
                        "value":"0",
                        "clickaction":"switchOption",
                        "handler":"",
                        "image":"assets\/components\/migx\/style\/images\/cross.png"
                      }
                    ],
                    "editor":""
                  },
                  {
                    "MIGX_id":10,
                    "header":"Published",
                    "dataIndex":"published",
                    "width":50,
                    "sortable":true,
                    "show_in_grid":1,
                    "customrenderer":"",
                    "renderer":"this.renderSwitchStatusOptions",
                    "clickaction":"switchOption",
                    "selectorconfig":"",
                    "renderchunktpl":"",
                    "renderoptions":[
                      {
                        "MIGX_id":1,
                        "name":"published",
                        "use_as_fallback":1,
                        "value":1,
                        "clickaction":"switchOption",
                        "handler":"",
                        "image":"assets\/components\/migx\/style\/images\/tick.png"
                      },
                      {
                        "MIGX_id":2,
                        "name":"published",
                        "use_as_fallback":"",
                        "value":1,
                        "clickaction":"switchOption",
                        "handler":"",
                        "image":"assets\/components\/migx\/style\/images\/tick.png"
                      },
                      {
                        "MIGX_id":3,
                        "name":"unpublished",
                        "use_as_fallback":"",
                        "value":"0",
                        "clickaction":"switchOption",
                        "handler":"",
                        "image":"assets\/components\/migx\/style\/images\/cross.png"
                      }
                    ],
                    "editor":""
                  }
                ],
                "category":""
              }





              all my projects snippet does is call the projcects class & pass on some properties:


              <?php
              
              //$modx->log(modX::LOG_LEVEL_ERROR,'Running snippet. '.print_r($scriptProperties,TRUE));
              
              $output = '';
              
              $core = $modx->getOption('core_path').'components/projects/model/';
              
              $project = $modx->getService('projects', 'Projects', $core, $scriptProperties);
              
              if (!$project instanceof Projects){
              
              	return 'Insantiation failed during snippet execution';
              
              }else{
              
                $function = isset($scriptProperties['function']) ? $scriptProperties['function'] : FALSE;
                
                if(!$function){return;}
                
                $output = $project->$function($scriptProperties);
              
              }
              
              return $output;



              And the function in the class:
              
              public function getListBoxOption($scriptProperties){    	
              
              	    	$output = '';
              
              	    	$alias = (isset($scriptProperties['alias'])) ? $scriptProperties['alias'] : FALSE;
              
              	    	$object_id = (isset($scriptProperties['object_id'])) ? $scriptProperties['object_id'] : FALSE;
              
              	    	$return_column = (isset($scriptProperties['return_column'])) ? $scriptProperties['return_column'] : FALSE;
              
              	    	if(!$alias || !$object_id || !$return_column){ return 'Missing object parameters.'; }
              
              			$option = $this->modx->getObject($alias, $object_id);
              
              			if($option){
              
              				return $option->get($return_column);
              
              			}else{
              				return ' No options found.';
              			}
              
              	    	 return;
              
              	    }


                *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

                Sean Kimball CLP, CLS.
                Technical Director / Sr. Developer | BigBlock Studios
                ._______________________________________________.
                Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
                27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
                phone/fax: 905-426-5525
                • 26503
                • 620 Posts
                Now of course those listbox fields sort by ID in the grid, not by the category/status name ... need to figure sorting options out now.
                  *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

                  Sean Kimball CLP, CLS.
                  Technical Director / Sr. Developer | BigBlock Studios
                  ._______________________________________________.
                  Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
                  27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
                  phone/fax: 905-426-5525