How to assign id and class to checkbox?

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
User avatar
ethan2cyc
Forum Members
Forum Members
Posts: 28
Joined: Sun Jan 09, 2011 1:29 pm

How to assign id and class to checkbox?

Post 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.
User avatar
ethan2cyc
Forum Members
Forum Members
Posts: 28
Joined: Sun Jan 09, 2011 1:29 pm

Re: How to assign id and class to checkbox?

Post by ethan2cyc »

nobody know how to tix it?
Wishbone
Power Poster
Power Poster
Posts: 1368
Joined: Tue Dec 23, 2008 8:39 pm

Re: How to assign id and class to checkbox?

Post by Wishbone »

Have you tried using the 'addtext' parameter? Just put whatever you want in that field, such as:

'class="foo" id="bar"'
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: How to assign id and class to checkbox?

Post by Dr.CSS »

Have you tried going to the Comments modules admin and putting the class on it in the template?...
maranc
Forum Members
Forum Members
Posts: 249
Joined: Tue May 04, 2010 5:04 pm

Re: How to assign id and class to checkbox?

Post 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.
Post Reply

Return to “Modules/Add-Ons”