Skip to main content
Topic: Admin panel and errors (Read 2154 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Admin panel and errors

At the moment almost any time you do a mistake on the admin panel, you get a fatal_lang_error and are sent back to the page. Then the page is refreshed, because with the new tokens it cannot be submitted twice and the values you entered are obliterated.

This is indeed a pain.

What I would like to see in 1.1 is a major improvement in that area.
I see two ways of "fixing" this.

The first is the one I applied to my topic prefixes addon:
https://github.com/emanuele45/TopicPrefix/blob/master/ManagePrefix.controller.php#L60
https://github.com/emanuele45/TopicPrefix/blob/master/ManagePrefix.controller.php#L101
if the "save" action fails, the new settings are stored in the session and loaded when the page is refreshed.
This has a huge drawback: is something goes "out of sync" (i.e. for any reason the session is not cleared) you may end up with unwanted settings in the page.

The second is more in line with the times and is: on saving, instead of submitting the form, send an AJAX request, wait for the result, and if the result is "green light" refresh the page and "happy saved" (actually the data were already saved on the AJAX request), while if the save failed, update the tokens and highlight the errors.
The drawback of this one is... well, it requires javascript to work "properly", and may require some adjustments to the template (namely each setting has to have an id attached to the input or to the area that should be highlighted with the error), though it avoids any problem that may arise with using $_SESSION.

I personally lean towards the second option, even though it may require some more work.

What do you think?
Bugs creator.
Features destroyer.
Template killer.

Re: Admin panel and errors

Reply #1

Me too (the second one). That's the behaviour we know from any forms on the net. But what will happen when Javascript isn't active? This is a problem on tablets, or am I wrong?

Re: Admin panel and errors

Reply #2

I doubt tablets do not handle javascript, in the web of today they (the tablets) would be useless if this was true.
Bugs creator.
Features destroyer.
Template killer.

Re: Admin panel and errors

Reply #3

Okay, I am only using this devices and trust you completely on this. No problem for me then, go ahead. ;)

Re: Admin panel and errors

Reply #4

I prefer to move up with the times. :)
Success is not the result of spontaneous combustion, you must set yourself on fire!