Please upgrade here. These earlier versions are no longer being updated and have security issues.

Problem with the target after form post

steamsteam www.planamigo.org - #1 foro planes amigo
edited November 2015 in Vanilla 2.0 - 2.8

Hi.
I have a problem with the target after form post.
From a comment I want to send a private message through popup window.

I have created url like:
echo anchor .... url('/messages/add/'.$Args['Author']->Name.'?Target='.urlencode('/discussion/pmessage'), true), 'PM Popup', ...

I see two ways:

1 - After submit form, I try to redirect to my custom method to show message and do nothing.
public function DiscussionController_pmessage_Create($Sender) { $Sender->informMessage("Your private message is sent."); }
but vanilla can not find it. I prefer this solution, but it does not work.

2 - Another solution is redirect back
If I redirect with self Target='.urlencode($Sender->SelfUrl)
It redirects me to start of the discussion losing the position of message.

I have to put url as / discussion / comment / 93 / # Comment_93 or is there another way? Then would have to find how display the message to the user.

Thanks in advance.

Tagged:

Comments

  • Options 2 is correct. If a POST action creates a new ID, you redirect to the new ID.

    My themes: pure | minusbaseline - My plugins: CSSedit | HTMLedit | InfiniteScroll | BirthdayModule | [all] - PM me about customizations

    • Vanilla APP » Learn more «
    • iOS & Android App for Vanilla - White label app for your forum
  • steamsteam www.planamigo.org - #1 foro planes amigo
    edited November 2015

    @Bleistivt dijo:
    Options 2 is correct. If a POST action creates a new ID, you redirect to the new ID.

    No, not create new ID. It's popup window to send private message but I want return user to original comment where is the pm link to open post form by popup.

    Maybe I have to redirect to my controller first and then invoke controller add private message /messages/add/username I don't know how to invoke method message add on controller.

Sign In or Register to comment.