Custom fields at the beginning

General discussion of Mantis.

Moderators: Developer, Contributor

Post Reply
LukeWCS
Posts: 10
Joined: 11 Mar 2021, 13:22
Location: Germany

Custom fields at the beginning

Post 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.
LukeWCS
Posts: 10
Joined: 11 Mar 2021, 13:22
Location: Germany

Re: Custom fields at the beginning

Post 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.
LukeWCS
Posts: 10
Joined: 11 Mar 2021, 13:22
Location: Germany

Re: Custom fields at the beginning

Post 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 713 times
Update page:
PicPick_2021-03-14_19-16-23_.png
PicPick_2021-03-14_19-16-23_.png (90.91 KiB) Viewed 713 times
Config module:
PicPick_2021-03-14_19-12-23.png
PicPick_2021-03-14_19-12-23.png (59.12 KiB) Viewed 713 times
cas
Posts: 1072
Joined: 11 Mar 2006, 16:08
Contact:

Re: Custom fields at the beginning

Post by cas »

so will you share this plugin?
LukeWCS
Posts: 10
Joined: 11 Mar 2021, 13:22
Location: Germany

Re: Custom fields at the beginning

Post 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.
cas
Posts: 1072
Joined: 11 Mar 2006, 16:08
Contact:

Re: Custom fields at the beginning

Post by cas »

You can always connect to a post here, no problem :mrgreen:
LukeWCS
Posts: 10
Joined: 11 Mar 2021, 13:22
Location: Germany

Re: Custom fields at the beginning

Post 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
Post Reply