Page 1 of 1

Get Rid of <None> in fields

Posted: 2016-02-28 17:48
by shasta59
Using AppGini 5.50

If you wish to get rid of the display of <None> there is a very easy way to do this.

Change the following code in ajax_combo.php

Look for:

Code: Select all

$prepared_data[] = array('id' => empty_lookup_value, 'text' => "<{$Translation['none']}>");
Change it to:

Code: Select all

$prepared_data[] = array('id' => empty_lookup_value, 'text' => "");
No longer will a <None> be displayed. A blank line will be displayed instead.
Voila_Capture646.jpg
Voila_Capture646.jpg (14.99 KiB) Viewed 5823 times
Voila_Capture645.jpg
Voila_Capture645.jpg (14.46 KiB) Viewed 5823 times
A hint:

Do not remove the original line but comment it out and copy and paste a new line as shown below. This makes it easy to revert if you wish.

Code: Select all

$prepared_data[] = array('id' => empty_lookup_value, 'text' => "");
//$prepared_data[] = array('id' => empty_lookup_value, 'text' => "<{$Translation['none']}>");
Enjoy

Alan

Re: Get Rid of <None> in fields

Posted: 2016-02-29 00:53
by grimblefritz
Isn't the easier way to do this to make the field required (not null)? You only get the none option if null is a valid option, right?

Re: Get Rid of <None> in fields

Posted: 2016-02-29 01:15
by shasta59
In the case of my example the field is required. Here is the parameters of the field from the above example.

int(10) unsigned NOT NULL,

So that would not be the case in my experience. As you can see the field is 'not null' but still the <None> came up. This way I was able to eliminate it.
Actually I use a nicer method. I have setup my own set of preferences page in the admin section which allows me to control and set many parameters. This is one of them. I go into admin. Then to the area for this table I can set it to either show or not show the 'none' field with a click. I control over 50 parameters this way.

It took a lot of time to write the necessary code but the ability to set many parameters made it worth the time and effort.

Alan

Re: Get Rid of <None> in fields

Posted: 2016-02-29 02:09
by peebee
Or another simple alternative - replace "None" with "Select" (or text of your choice) by editing the language string in language.php

$Translation['none'] = 'None';

becomes

$Translation['none'] = 'Select';

Re: Get Rid of <None> in fields

Posted: 2016-02-29 13:30
by grimblefritz
I have done several apps in 5.50 that use both lookups and option lists. Making the field Required eliminates the None option.

Is it possible something in your admin module isn't up to date with 5.50 behaviors?

BTW, I very much appreciate the custom admin module. I have done something similar with external scripts, though not 50 options deep. I've also requested a feature for the build app to be able to trigger an external script post-build so these changes can be automatically applied.