Jump to content


\IPS\Helpers\Form\Item - topic list and sorting shenanigans

Go to solution Solved by Matt,

Recommended Posts

Something I've brought up previously in the Contributor Chat forum, but it drifted off into the ether...never to be seen again.

I've recently gone back to the POC for something, and this behaviour is still there and it's frankly nonsense.

Background: there is something in the POC application which will be relying on the order of entry being kept 'as is' as the setting is going to be used later to display things in the chosen order.

My settings code - nice and simple, it works...

$form->add(new \IPS\Helpers\Form\Item('tids', \IPS\Settings::i()->tids, TRUE, array('class' => '\IPS\forums\Topic')));
if ($values = $form->values()) {
    return TRUE;
return $form;

Result, pre-save (note the order for the topics is 2,3,1)


Save the form - result (note the order for the topics is now 3,2,1)


The issue is that when the above form is saved, the fields values are sorted in DESC order based on the topic ID.

Dumping the $values/$form->values to the screen immediately upon the Save button being clicked shows that the sort has already taken place before the 'saveAsSettings' has been processed.

I can't see anything that will allow me to specify NOT to do the sort, so any chance that something can be added in?

I've got a workaround to this in my application, which involves using a different form in a dialog to add a single item to an existing list of topic IDs which works but feels clunky.

Edited by Nathan Explosion
Link to post
Share on other sites
  • 4 weeks later...
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...

Important Information

We use technologies, such as cookies, to customise content and advertising, to provide social media features and to analyse traffic to the site. We also share information about your use of our site with our trusted social media, advertising and analytics partners. See more about cookies and our Privacy Policy