Page 1 of 1

Multiple Choice List Box

Posted: 2017-09-05 15:59
by gatenet
Hi there forum i need help. When we put data in appgini programm in multiple choice list box when we generate that in which file does this data goes, lets say that we forgot to put 1 item there where i will find that data to update it?
Thank you

Re: Multiple Choice List Box

Posted: 2017-09-06 01:16
by peebee
Look in your_tablename_dml.php

Here's an example of what you're looking for

Code: Select all

	// combobox: your_field_name
	$combo_your_field_name = new Combo;
	$combo_your_field_name->ListType = 3;
	$combo_your_field_name->MultipleSeparator = ', ';
	$combo_your_field_name->ListBoxHeight = 10;
	$combo_your_field_name->RadiosPerLine = 1;
	if(is_file(dirname(__FILE__).'/hooks/tablename.your_field_name.csv')){
		$your_field_name_data = addslashes(implode('', @file(dirname(__FILE__).'/hooks/tablename.your_field_name.csv')));
		$combo_your_field_name->ListItem = explode('||', entitiesToUTF8(convertLegacyOptions($your_field_name_data)));
		$combo_your_field_name->ListData = $combo_your_field_name->ListItem;
	}else{
		$combo_your_field_name->ListItem = explode('||', entitiesToUTF8(convertLegacyOptions("Edit Your Options;;Option 1;;Option 2;;Option 3;;Option 4;;Option 5")));
		$combo_your_field_name->ListData = $combo_your_field_name->ListItem;
	}
The line to add to/edit your multiple choices is this one below. Separate the options with a ;;

Code: Select all

$combo_your_field_name->ListItem = explode('||', entitiesToUTF8(convertLegacyOptions("Edit Your Options;;Option 1;;Option 2;;Option 3;;Option 4;;Option 5")));

Re: Multiple Choice List Box

Posted: 2017-09-18 20:20
by gatenet
Thank you my friend

Re: Multiple Choice List Box

Posted: 2022-06-12 06:38
by ppfoong
What would be the suggested way if I want the admin user to be able to add/edit/delete the options in convertLegacyOptions?

I am thinking about putting the selection string as a variable or defined constant, which is included from a config file, and provide a simple text editing interface for the admin user to edit that config file.

However, if the admin user screwed up this config file, it might break the convertLegacyOptions, or even introduce security issue.

Is there any better, more fool proof and more secure way?

Thanks.