e107sk.com

Forums


  • 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;
    ......
     

  • 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.
     

Moderator(s): CaMer0n, Jimako, kreossino

Other links

Follow us