FormContainer default selected option on select box.
#2
You have a syntax issue. The third one is for selected, and the current third one (your last one) should be at fifth.

	$selected = 'tinyint'; // For example
	$id = 'my_select'; // If you wanna set one, else pass a blank array
	$select_options = array('string' => $lang->string, 'integer' => $lang->integer, 'tinyint' => $lang->tinyint, 'text' => $lang->text, 'boolean' => $lang->boolean);
	$custom_select = $form->generate_select_box('definition', $select_options, $selected, array('id' => $id), 'definition');
	
	$form_container->output_row($lang->definition, "$lang->definition_desc", $custom_select);

Or as a one-liner:

$form_container->output_row($lang->definition, "$lang->definition_desc", $form->generate_select_box('definition', array('string' => $lang->string, 'integer' => $lang->integer, 'tinyint' => $lang->tinyint, 'text' => $lang->text, 'boolean' => $lang->boolean), 'tinyint', array('id' => 'my_select'), 'definition'));

... and yes, you should surely be able to use the class once you add it in your script using require_once or include_once.
Reply


Messages In This Thread
RE: FormContainer default selected option on select box. - by effone - 2019-01-09, 09:57 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)