Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Try Vanilla Forums Cloud product
Please upgrade to 2.3 here. The 2.2 and earlier branches are no longer being updated.

How to set up a form popup from discussion list and a specific discussion

rbrahmsonrbrahmson "You may say I'm a dreamer / But I'm not the only one"NY ✭✭✭

I am writing a plugin that places a link in the discussion meta area that calls my plugin ("PluginController_MyPlugin_Create"). The plugin is invoked in a popup (as intended) because the link is set to a class that has "Hijack Popup". Now I need to set the form within the popup (prime variables, check values, retrieve them, etc.).

Not sure how to do that because all the examples I found bring up a form with a view outside the popup.

Last but not least, upon return from the popup form (unless the user selected the cancel button) I want to refresh the information on the screen.

Comments

  • rbrahmsonrbrahmson "You may say I'm a dreamer / But I'm not the only one" NY ✭✭✭

    Adding to the above: I am not sold on using Hijack Popup, but:
    (1) without it any form displayed through the "PluginController_MyPlugin_Create" does not appear on the screen I want and once the form is submitted the user is not returned ot the same screen and position.
    (2) With it the form appears to be posted before I initialize the fields ($Sender->Form->authenticatedPostBack() is TRUE when I get control)

    All I really want is to display is a popup form on the existing screen that invoked the ""PluginController_MyPlugin_Create" function so that when the user submits the form he is back on the screen when he invoked it.

  • hgtonighthgtonight ∞ · New Moderator

    I suggest you get the form working without the popup and then add it in. This ensures your plugin works without javascript enabled.

    You refresh the page using the jsonTarget method on the controller.

    Mind sharing your code so I can help you with the specifics?

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • rbrahmsonrbrahmson "You may say I'm a dreamer / But I'm not the only one" NY ✭✭✭

    Thanks @hgtonight!
    FYI, the form is working without the popup mode exhibiting symptom #1 above (appearing in a Vanilla screen that lacks menu and looks quite weird). But I receive the form data and update the discussion.

    indeed I use the jsonTarget method in the controller which refreshes the values in the meta area (just as I did in the DiscussionAlert plugin). But that only works with the popup...

    Will clean up a bit before sharing.

  • rbrahmsonrbrahmson "You may say I'm a dreamer / But I'm not the only one" NY ✭✭✭

    Doesn't seem to make a difference - with or without the Hijack I cannot seem to be able to prime the text area within the form. Current plugin state enclosed. Once I resolve the issue and complete the todo list on the plugin I will upload it to the plugin directory once it is complete. Thanks again for your help!

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    A pop up is just another page displayed as a popup. Here I added the class="Popup" to the link of this discussion into the web inspector... As long as there is css style for popups anything that you add the class to will be in a popup.

  • rbrahmsonrbrahmson "You may say I'm a dreamer / But I'm not the only one" NY ✭✭✭
    edited February 2016

    Thanks. The problem is now reduced to priming the textarea input with variable data as well as the fact that when checking for authenticatedPostBack() it behaves as if the form is always in postback...
    These two may be related...

  • rbrahmsonrbrahmson "You may say I'm a dreamer / But I'm not the only one" NY ✭✭✭

    Thank you @hgtonight and @vrijvlinder - I managed to solve ALL the outstanding issues. Please do not spend any more time on this.
    I will clean up the plugin and upload it to the community.
    Thanks for your help !

Sign In or Register to comment.