Page 1 of 1

How to assign id and class to checkbox?

Posted: Sun Apr 24, 2011 2:05 am
by ethan2cyc
The checkbox is not assigned the class and id in the comments module. I want to fix it.
so I find the CreateInputCheckbox function in
\modules\Comments\action.default.php

Code: Select all

$this->smarty->assign_by_ref('inputnotify', 		$this->CreateInputCheckbox($id, 'authornotify', 1, $authornotify));
and it's come from
\lib\classes\class.module.inc.php

Code: Select all

	function CreateInputCheckbox($id, $name, $value='', $selectedvalue='', $addttext='')
	{
		$this->LoadFormMethods();
		return cms_module_CreateInputCheckbox($this, $id, $name, $value, $selectedvalue, $addttext);
	}
the cms_module_CreateInputCheckbox() is come from
\lib\classes\module_support\modform.inc.php

Code: Select all

function cms_module_CreateInputCheckbox(&$modinstance, $id, $name, $value='', $selectedvalue='', $addttext='')
{
  $id = cms_htmlentities($id);
  $name = cms_htmlentities($name);
  $value = cms_htmlentities($value);
  $selectedvalue = cms_htmlentities($selectedvalue);

	$text = '<input type="checkbox" class="cms_checkbox" name="'.$id.$name.'" value="'.$value.'"';
	if ($selectedvalue == $value)
	{
		$text .= ' ' . 'checked="checked"';
	}
	if ($addttext != '')
	{
		$text .= ' '.$addttext;
	}
	$text .= " />\n";
	return $text;
}
you could see the class is assigned, but it's missing when output. And whenever how I change this function, it still output the same content.
And I check the BO, all of the checkboxes are not assigned class either.
Is there anyone know about these problem?

thank you.

Re: How to assign id and class to checkbox?

Posted: Mon Apr 25, 2011 3:10 pm
by ethan2cyc
nobody know how to tix it?

Re: How to assign id and class to checkbox?

Posted: Tue Apr 26, 2011 4:44 pm
by Wishbone
Have you tried using the 'addtext' parameter? Just put whatever you want in that field, such as:

'class="foo" id="bar"'

Re: How to assign id and class to checkbox?

Posted: Tue Apr 26, 2011 6:31 pm
by Dr.CSS
Have you tried going to the Comments modules admin and putting the class on it in the template?...

Re: How to assign id and class to checkbox?

Posted: Tue Apr 26, 2011 8:43 pm
by maranc
http://www.cmsmadesimple.org/apidoc/CMS ... utCheckbox

As you see here isn't any params class or id.
You can do it this, using smarty function replace.

Marek A.