Recent Topics

1 Feb 21, 2008 23:11    

I'm probably missing something obvious, but I've got a plugin/widget that has a back-office parameter that is a checkbox.

Once the plugin is installed, I add the widget to my skin and check the checkbox. Immediately, I go back to edit the widget, and the checkbox is no longer checked!

Code excerpts from the plugin:


	var $social_supported = array ( 
	                     'Stumble Upon', 
//	                     'Digg',
//	                     'Del.icio.us'
	                     );
.
:

	function get_widget_param_definitions( $params )
	{  	
	   $r = array();
	   
	   foreach ( $this->social_supported as $social_name )
	   {
         $r[ $social_name ] = array(
					'label' => $social_name,
					'note' => '',
					'type' => 'checkbox',
   				'defaultvalue' => false,
					);
      }     	      

	return $r;			
   }

The plugin's only other functions are PluginInit and SkinTag.

I've removed the widget, uninstalled the plugin, cleared my browser's cache, and reinstalled the plugin and widget. While uninstalled, I did check the database and make sure the plugin was gone.

Any ideas?

- Cindy Rae

2 Feb 22, 2008 20:28

Aha!

In the code in the original post, notice the

         $r[ $social_name ] = array(
               'label' => $social_name, 

which resolves to

         $r[ 'Stumble Upon' ] = array(
               'label' => 'Stumble Upon', 

The problem is the space in the first 'Stumble Upon'. b2e uses that string in the "label for" and "input" tags:


<div class="label"><label for="edit_plugin_281_set_Stumble Upon">Stumble Upon:</label></div>
<div class="input"><input name="edit_plugin_281_set_Stumble Upon" value="1" class="checkbox" id="edit_plugin_281_set_Stumble Upon" type="checkbox">

This causes problems when you try to update the widget's parameters.

Hope this helps someone else!

- Cindy Rae

3 Feb 22, 2008 20:36

Thanks for reporting what you found!


Form is loading...