Page 1 of 1

Radio Group

Posted: Fri Apr 27, 2007 3:58 am
by Nullig
Is there a smarty syntax similar to:

$this->smarty->assign('inputcategory', $this->CreateInputText($id, 'cat_name', $cat_name, 50, 255));

for creating a radio group?

Thanks,
Nullig

Re: Radio Group

Posted: Fri Apr 27, 2007 5:07 am
by cyberman
Do you have made a look at apidocs :)?

http://www.cmsmadesimple.org/apidoc/CMS ... RadioGroup

Re: Radio Group

Posted: Fri Apr 27, 2007 6:05 am
by Nullig
Thanks.

Nullig

Re: Radio Group

Posted: Fri Apr 27, 2007 6:41 pm
by Nullig
Trying to use the CreateInputRadioGroup function, but having a problem.

Code: Select all

$catlist = array();
	
$query = "SELECT * FROM ".cms_db_prefix()."module_videocollector_category ORDER BY cat_name";
$dbresult = $db->Execute($query);
	
while ($dbresult && $row = $dbresult->FetchRow())
{
	$onerow = new stdClass();

	$onerow->cat_id = $row['id'];
	$onerow->cat_name = $row['cat_name'];
	$catlist[] = $onerow;

}


$this->smarty->assign('inputcat', $this->CreateInputRadioGroup($id, 'cat_id', $catlist[1], '1'));
In using the above code, the labels for the radio buttons are showing as "cat_id" and "cat_name" and not the values assigned.

Where have I gone wrong?

Thanks,
Nullig

Re: Radio Group

Posted: Fri Apr 27, 2007 8:59 pm
by alby
Nullig wrote: Trying to use the CreateInputRadioGroup function, but having a problem.
Example of CreateInputRadioGroup:

Code: Select all

$view_map = $this->GetValueDB('view_map', $adding);
$view_maps = array('On'=>1, 'Off'=>0);

$ret[]= array($this->Lang('view_map').':',$module->CreateInputRadioGroup('','view_map', $view_maps, $view_map));
Try with:

Code: Select all

........
$catlist[$row['cat_name']] = $row['id'];
........
Alby

Re: Radio Group

Posted: Fri Apr 27, 2007 9:12 pm
by Nullig
Perfect. Thanks alby.

Nullig