Page 1 of 1

Custom fields at the beginning

Posted: 11 Mar 2021, 13:46
by LukeWCS
Hi

I've been trying to find a solution to this problem for months. I want to have custom fields at the top of the bug report page. So far I have changed the bug_report_page.php file directly by moving the code for the custom fields to the top of the form. However, this has 2 disadvantages:

1. I have to make this change every time I update Mantis.
2. User-defined fields are then always at the beginning. However, I only want certain fields at the beginning.

I then read here in the forum that this should best be solved with jQuery. So I looked up all the necessary functions in the jQuery documentation and created a small script from them that can solve the task. With the help of a plugin HowTo here in the forum, I was then able to turn it into a plugin. That also worked in the end. Unfortunately, I then found out that the bug report form could no longer be sent. Obviously, the jQuery manipulation corrupts the form.

I'm at my wits end. Is there no clean and working solution to the problem? I only find inquiries about this everywhere, but nowhere a working solution.

Re: Custom fields at the beginning

Posted: 12 Mar 2021, 10:47
by LukeWCS
I've been able to solve the problem in the meantime. I missed 2 things:

On the one hand, there is another table in the table of the form that was responsible for several problems. Since I created the system profile directly in the user profile and defined it as the standard, I didn't even think about this second table.

On the other hand, I was not aware that the jQuery function with which I move elements also clones and inserts the element in other places at the same time if several elements are found whose properties match the selector.

Once I noticed these facts I was able to solve the problems and now my JS & jQuery script is working as expected.

As far as the plugin system is concerned: Thanks to rkarmanm for the Plugin HowTo, that was very helpful for me.

Re: Custom fields at the beginning

Posted: 14 Mar 2021, 18:19
by LukeWCS
Small feedback: In the meantime, my JS / jQuery script has become a full-fledged plugin, as I imagined, including a config module.

Report page:
PicPick_2021-03-14_19-11-26_.png
PicPick_2021-03-14_19-11-26_.png (69.62 KiB) Viewed 5733 times
Update page:
PicPick_2021-03-14_19-16-23_.png
PicPick_2021-03-14_19-16-23_.png (90.91 KiB) Viewed 5733 times
Config module:
PicPick_2021-03-14_19-12-23.png
PicPick_2021-03-14_19-12-23.png (59.12 KiB) Viewed 5733 times

Re: Custom fields at the beginning

Posted: 15 Mar 2021, 11:50
by cas
so will you share this plugin?

Re: Custom fields at the beginning

Posted: 16 Mar 2021, 13:07
by LukeWCS
cas wrote: 15 Mar 2021, 11:50 so will you share this plugin?
Basically nothing speaks against it, but several steps are necessary if I see these instructions. Quite a lot of effort.

Re: Custom fields at the beginning

Posted: 16 Mar 2021, 13:49
by cas
You can always connect to a post here, no problem :mrgreen:

Re: Custom fields at the beginning

Posted: 17 Mar 2021, 13:50
by LukeWCS
cas wrote: 16 Mar 2021, 13:49 You can always connect to a post here, no problem :mrgreen:
See here: https://www.mantisbt.org/forums/viewtop ... 15&t=27408