Menu

Passing an alert / notification through GET parameters?

2024-04-11
2024-04-12
  • Jacques Dancause

    Hey there,

    In our implementation of iTop, we have a custom form that redirects the user to the details view of an object once the form is submitted.

    Sometimes, the form is submitted with no changes, but it is not apparent to the user. The form is still redirected with a header call to the details view of the object. My question is, is there any way to implement a notification kind of like this one:
    itop notification
    By passing something in the get parameters? I'd like to tell the user that they did not change anything.

    Thanks a lot
    Jacques

     
    👍
    1
  • Jeffrey Bostoen

    Jeffrey Bostoen - 2024-04-12

    Hm, can you share a bit more info / screenshots on your implementation?

    What kind of custom form?

     
    • Jacques Dancause

      Sure, essentially I've got an entry point on a Class (it's called Planning) with the ApplicationUIExtension interface, and in OnDisplayRelations I add a custom tab to Plannings, that allows users to add them to Deployments. It shows a custom form:
      custom form
      and the form action leads to another php file which handles the object creation. Once the code is finished executing I redirect the user back to the previous page with a header() call. That means that the only way I have to pass data back to the main page is through query parameters in the URL.

      I thought perhaps another way would be to redirect back to the Deployment Creator form with $_GET args, but I'm not sure there is any way to detect those from within an entry point such as OnDisplayRelations.

      Thoughts?

       

      Last edit: Jacques Dancause 2024-04-12
      • Jeffrey Bostoen

        Jeffrey Bostoen - 2024-04-12

        As for the notification - you could consider adding an intermediate page in between, or indeed passing a URL parameter and then inject some JavaScript to show your own notification.

        I haven't checked the code, but I'd only expect that notification (no changes) to show up if you do some sort of POST request to the page instead?

         
        ❤️
        1
        • Jacques Dancause

          That's a great idea, thanks Jeffrey.

          That notification is the built-in one you get when you edit an object and save without changing anything, I assume it is a POST request, but I think it's just a flag. I had a look through the request/responses on the page and couldn't find much of interest.

          I will explore these avenues. I am considering also injecting Javascript on the form and doing some client-side validation.

           
          👍
          1

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.