[Support request] Injecting custom JS

  • May 26, 2021 at 8:43 am #7689
    J
    JulienVDC
    Participant

    Hey there,

    I am looking for suggestions/ideas on how I could easily inject and maintain custom scripts I am creating for out OST instance.

    I don’t know if what I have in my head is possible but, what I am thinking of is to create/add a file for all my scripts that would automatically be loaded (ideally I could specify on which pages, but not a must-do). This way I wouldn’t have to modify any of the core files which would make my life easier whenever I’d upgrade and go over any of the modifications I have made… 🙂

    What do you guys think?

    Julien

  • June 8, 2021 at 4:50 am #7716
    J
    JulienVDC
    Participant

    hey little update…

    We’re looking to have some sort of conditional fields in our forms. For example: if item B is selected in dropdown, then hide the next 3 fields.
    We managed to build some javascript that can achieve this. However we’ve realized that the custom form/field names and ids are generated randomly and will change from one user to another (to prevent from spammers). Which makes our scripts irrelevant…

    I read some ideas about removing the bit in the code that rules the random generations, but I am not too keen to edit the core code.

    So I am wondering if anyone has done this another way or has suggestions ?

  • May 8, 2022 at 4:52 pm #10241
    c
    cartmega
    Participant

    Hi Julien,

    You should try Motherload. https://www.cartmega.com/software/osticket/motherload-for-osticket.html

    Our Superlists plugin for osTicket Motherload is implementing something similar to what you suggest on the new Ticket page (client side).

    Basically it identifies and hides various custom fields on the form and replaces them with dropdown lists.

    I am positive that you could achieve your goal.

    Coincidentally, I just uploaded a new free plugin for Motherload called JSInject that can help to inject custom Javascript into osTicket.

    Hope this helps.

You must be logged in to reply to this topic.

Topic Tags