Get Rid of <None> in fields

The recommended method of customizing your AppGini-generated application is through hooks. But sometimes you might need to add functionality not accessible through hooks. You can discuss this here.
Post Reply
User avatar
shasta59
AppGini Super Hero
AppGini Super Hero
Posts: 231
Joined: 2013-01-08 19:40
Location: Calgary, Alberta, Canada

Get Rid of <None> in fields

Post by shasta59 » 2016-02-28 17:48

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 4834 times
Voila_Capture645.jpg
Voila_Capture645.jpg (14.46 KiB) Viewed 4834 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
Calgary, Alberta, Canada - Using Appgini 5.50 -

grimblefritz
AppGini Super Hero
AppGini Super Hero
Posts: 336
Joined: 2015-12-23 16:52

Re: Get Rid of <None> in fields

Post by grimblefritz » 2016-02-29 00:53

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?

User avatar
shasta59
AppGini Super Hero
AppGini Super Hero
Posts: 231
Joined: 2013-01-08 19:40
Location: Calgary, Alberta, Canada

Re: Get Rid of <None> in fields

Post by shasta59 » 2016-02-29 01:15

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
Calgary, Alberta, Canada - Using Appgini 5.50 -

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

Re: Get Rid of <None> in fields

Post by peebee » 2016-02-29 02:09

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';

grimblefritz
AppGini Super Hero
AppGini Super Hero
Posts: 336
Joined: 2015-12-23 16:52

Re: Get Rid of <None> in fields

Post by grimblefritz » 2016-02-29 13:30

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.

Post Reply