I know, everybody hates ads. But you dislike to pay for something too. I would like to give everything for free, but it's impossible because costs are too much. If you know how Google ads work, you know how to help. It's on you. I can detect income by country, so... Australia rocks now! Thanks

Multicheck field in admin UI - options array

Viktor » 1 month ago
I have another problem with the Multicheck field in admin UI.
The newly created field has a value of "None selected"
If this value is not changed (do not select list items), then the value "None selected" is saved.
If you select list items 1 or 2 or more and save this value, then you cannot return to the "None selected" value.
You can select "None selected", but you cannot save.

Part of the code public function init ()
$ boards = array ();
if (e107 :: getDb () -> select ('trips_boarding', '*', 'trips_boarding_approved = 1'))
while ($ row = e107 :: getDb () -> fetch ())
$ id = $ row ['trips_boarding_id'];
$ boards [$ id] = $ row ['trips_boarding_name'];

$ this-> fields ['trips_boarding'] ['writeParms'] ['optArray'] = $ boards;
$ this-> fields ['trips_boarding'] ['writeParms'] ['multiple'] = 1;

Level 1

Jimako » 1 month ago
Sorry, I didn't get notification about new post, only about new PM. Create new topic at the future :)

Try this:
$parents = e107::getDb()->retrieve("property_location", "*", "WHERE parent_id = 0", true);
            $parent_item[0] = "None selected";
            foreach($parents as $parent) {
              $parent_item[$parent['id']] = $parent['title'];
	        $this->fields['parent_id']['writeParms']['optArray'] =  $parent_item;

You need to have your options array with key 0. Value 0 means that nothing was selected.

If this is not clear, let me know.


Main Admin

Moderator(s): Jimako