Multiple Choice List Box

Got something cool to share with AppGini users? Feel free to post it here!
Post Reply
gatenet
Veteran Member
Posts: 45
Joined: 2016-07-26 09:34
Location: Greece
Contact:

Multiple Choice List Box

Post by gatenet » 2017-09-05 15:59

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

peebee
AppGini Super Hero
AppGini Super Hero
Posts: 352
Joined: 2013-03-21 04:37

Re: Multiple Choice List Box

Post by peebee » 2017-09-06 01:16

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")));

gatenet
Veteran Member
Posts: 45
Joined: 2016-07-26 09:34
Location: Greece
Contact:

Re: Multiple Choice List Box

Post by gatenet » 2017-09-18 20:20

Thank you my friend

ppfoong
Posts: 5
Joined: 2021-07-13 16:46

Re: Multiple Choice List Box

Post by ppfoong » 2022-06-12 06:38

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.

Post Reply