How can I handle form action URLs when I “GET” them

Notice: This thread is very old.
Morfeo21
Member | 35
+
0
-

Hi,
I have an issue – I have a fulltext form and it's action URL is: /?do=fulltext_fulltextForm-form-submit. Everything works OK. But when I copy this URL to browser and send it as GET request, nothing happens. Obviously, there are no POST data to handle. But I don't want URL like this to be accessed via GET request, so I'd like to redirect it or throw 404 or something like this.

But I have no idea where I can do this. Form's success method is not triggered. Is sany method trigerred when it happens and where I can handle it?

Thanks for any help :)

Morfeo21
Member | 35
+
0
-

Found it! I extended Form class and rewrote it's method fireEvents.

Last edited by Morfeo21 (2014-05-12 09:20)

petr.pavel
Member | 535
+
0
-

It would be interesting to know how you got the url with /?do=… because it's a url of a submitted form.

Is it that you want this gone after you submit a form? The solution is to redirect with $presenter->redirect() after having processed the form. The most important reason for redirecting actually, is to avoid repeated submissions on refresh or traversing browsing history.

Morfeo21
Member | 35
+
0
-

No no, I don't have this URL in link and of course I redirect after submitting form. But there is a fear that search engines crawl links in action attributes as well. And this URLs should not be displayed in Google … I know, it's a paranoic and makes no sense but it's not up to me … I'm just programmer :D