CMS MADE SIMPLE FORGE

Extended Content Blocks

 

[#9992] default_value parameters do not work

avatar
Created By: Robin (Cerulean)
Date Submitted: Mon May 12 22:17:30 -0400 2014

Assigned To:
Version: 1.5
CMSMS Version: 1.11.10
Severity: Minor
Resolution: Accepted
State: Open
Summary:
default_value parameters do not work
Detailed Description:
The module help says several of the ECB blocks can take a "default_value"
parameter, e.g.

{content_module module="ECB" field="checkbox" block="test11" label="Checkbox"
default_value="1"}
{content_module module="ECB" field="input" label="Text" block="test5" size=55
max_length=55 default_value="fill it"}
{content_module module="ECB" field="textarea" label="Textarea" block="test6"
rows=10 cols=40 default_value="fill it"}

But if you insert these demo module calls in your template, the blocks on the
"Edit Content" admin page don't display the default_value (checkbox is
unchecked, text fields are empty), and the default_value is not applied to the
block on the frontend either before or after the page is edited/saved.


History

Comments
avatar
Date: 2014-08-09 04:06
Posted By: Zdeno Kuzmany (xxl)

I'll  check it. 
Thank you for report
      
avatar
Date: 2015-07-08 19:20
Posted By: John Beatrice (mww)

I can confirm that the default value of a checkbox is not recognized in ver 1.6

Example: 
Create a checkbox field tag with a default value of 1
The expectation is that the checkbox will be checked by default because the
checkbox value is 1 and the default value is 1

in class.ecb_tools.php, the default value of the checkbox field is not being
used.
example solution would be to assign the value="" parameter's value to a
variable, and then check if that variable matches the template tag's default
value parameter option and then set the HTML checked parameter using the
createinput's selectedvalue var.

		$checkedvalue = '1';

		if ( $this->options["default_value"] == $checkedvalue ) {
			$selectedvalue = 'checked="checked"';
		}

return $mod->CreateInputHidden('', $this->block_name, 0) .
$mod->CreateInputCheckbox('', $this->block_name, $checkedvalue, $this->value,
$selectedvalue);



-- Before you hack/fix your installed module on your own, remember that it is
now recommended to hack/fix module code because it will disqualify you from
support... and possibly cause other problems with your installation.
      
Updates

Updated: 2014-08-09 04:06
resolution_id: 5 => 6

Updated: 2014-05-12 22:19
summary: Default parameters do not work => default_value parameters do not work
resolution_id: => 5