alternative for $this->action('xxx') ?
Permalink
Is there a alternative for
? I use this in the form action tag (block view). But the URL which is generated is not very nice.
Is there a way to post to the pretty-url and use the variables generated by "$this->action" in hidden fields or something like that?
Hope to hear from you soon.
Best wishes,
Marc
echo $this->action('xxx');
? I use this in the form action tag (block view). But the URL which is generated is not very nice.
Is there a way to post to the pretty-url and use the variables generated by "$this->action" in hidden fields or something like that?
Hope to hear from you soon.
Best wishes,
Marc
i sometimes just bypass action() completely since it doesn't work with hardcoded blocks, and instead use <?= View::url($c->getCollectionPath() )?> as the target. but then you have to manually add a token (lots of examples throughout the core), and have to get the block to know that the form submission is only intended for itself (by looking for a intval($bID) and perhaps a unique identifier for that block type, for when the block is hardcoded and there's no bID).
Would posting to a php file that extends controller in the tools folder be something to consider? I have dual use forms, they can be brought up using facebox using a $.get, and they also exist and are mostly used in the dashboard, so having one unified place to post async or not to would be nice. So would using tools be a valid thing to do in your opinion?
Thanks,
Scott
Thanks,
Scott
I understand that this is a subjective matter, but in my opinion I don't think that having ugly URL's on the page a form posts to is that bad, because the user rarely sees it.
When I was developing my own custom block/form, I was worried about this at first because after the form is submitted, it stays on that page with all of the ugly url cruft at the end, but I changed my controller code that responds to the form to redirect back to the original page upon successful completion of the form, so that the user would not see the ugly url (and this has the nice side-effect of not showing them the "Are you sure you want to post this data again" dialog in their browser if they hit refresh or the back button).
Note that in order to redirect back to the original page upon form completion, I had to put the original page's url in a hidden form field (because if the form is in a block, you never know what page it might be posted from because the user could put that block on any page in their site).
So now the only time the user sees the ugly url is if the form fails validation, but I considered this an acceptable trade-off (again, this is subjective so I understand if you don't even want that).
Hope that helps.
-Jordan
When I was developing my own custom block/form, I was worried about this at first because after the form is submitted, it stays on that page with all of the ugly url cruft at the end, but I changed my controller code that responds to the form to redirect back to the original page upon successful completion of the form, so that the user would not see the ugly url (and this has the nice side-effect of not showing them the "Are you sure you want to post this data again" dialog in their browser if they hit refresh or the back button).
Note that in order to redirect back to the original page upon form completion, I had to put the original page's url in a hidden form field (because if the form is in a block, you never know what page it might be posted from because the user could put that block on any page in their site).
So now the only time the user sees the ugly url is if the form fails validation, but I considered this an acceptable trade-off (again, this is subjective so I understand if you don't even want that).
Hope that helps.
-Jordan
First replace "&" to "&" in the action() method found in concrete/libraries/block_view.php. It should look like this:
and second replace all "&" with "&" in the _getBlockAction() method (line 517) in concrete/models/block.php
Should look like this:
cheers