Magento 2 Set $_POST to an empty Array()getFormAction() returns empty stringMagento does not pass empty varible in POST datasaveAction stores empty objectMagento 2 simple form submitmagento 2 get empty post array in version 2.0.5Array to string conversion in Magento 2Magento 2 | Get Post ParamsMagento 2 ui form multiselect field not checked not in $_POSTDirect use of $_FILES Superglobal detected. In magento 2Magento 1.9.2 - getRequest()->getParams returning with empty array
Why didn't Balak request Bilam to bless his own people?
Do gauntlets count as armor?
What is the difference between uniform velocity and constant velocity?
How to tell readers that I know my story is factually incorrect?
How can electronics on board JWST survive the low operating temperature while it's difficult to survive lunar nights?
Why should fork() have been designed to return a file descriptor?
Why didn't NASA launch communications relay satellites for the Apollo missions?
What does a Nintendo Game Boy do when turned on without a game cartridge inserted?
Improving an O(N^2) function (all entities iterating over all other entities)
Satellite in orbit in front of and behind the Moon
Can two waves interfere head on?
ISCSI, multiple initiaros for the same lun
When will the last unambiguous evidence of mankind disappear?
Killing a star safely
What does "play in traffic" mean?
Conditional statement in a function for PS1 are not re-evalutated
Why can't a country print its own money to spend it only abroad?
Why does Plot only sometimes use different colors for each curve
What is this light passenger prop airplane which crash landed in East Kalimantan, Borneo in 1983?
What is the origin of "Wonder begets wisdom?"
She told me that she HAS / HAD a gun
Redirection operator, standard input and command parameters
You have no, but can try for yes
How much did all the space agencies spent on rockets launching and space exploration? What are the benefits for me and you?
Magento 2 Set $_POST to an empty Array()
getFormAction() returns empty stringMagento does not pass empty varible in POST datasaveAction stores empty objectMagento 2 simple form submitmagento 2 get empty post array in version 2.0.5Array to string conversion in Magento 2Magento 2 | Get Post ParamsMagento 2 ui form multiselect field not checked not in $_POSTDirect use of $_FILES Superglobal detected. In magento 2Magento 1.9.2 - getRequest()->getParams returning with empty array
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I can't seem to find a way to set $_POST
to an empty array.
I have a form in phtml action to self I can get $_POST
values the following ways:
$this->getRequest()->getPostValue('form_key');
$this->getRequest()->getParam('form_key');
The Above will give Array ( [form_key] => FThdknnc_347djcncKey_)
Now I've tried to reset by doing:
$this->getRequest()->setPostValue('form_key');
But it gives me:
Array ([form_key] =>)
That ain't right browser still popping up saying that it will resend data from form: It should return Array ()
But the form_key key is still in the $_POST
Array. one can do in php:
$_POST = Array();
and that would be enough but it doesn't work with magento.
Anyone any idea?
forms magento2.2.2 post-data
add a comment |
I can't seem to find a way to set $_POST
to an empty array.
I have a form in phtml action to self I can get $_POST
values the following ways:
$this->getRequest()->getPostValue('form_key');
$this->getRequest()->getParam('form_key');
The Above will give Array ( [form_key] => FThdknnc_347djcncKey_)
Now I've tried to reset by doing:
$this->getRequest()->setPostValue('form_key');
But it gives me:
Array ([form_key] =>)
That ain't right browser still popping up saying that it will resend data from form: It should return Array ()
But the form_key key is still in the $_POST
Array. one can do in php:
$_POST = Array();
and that would be enough but it doesn't work with magento.
Anyone any idea?
forms magento2.2.2 post-data
add a comment |
I can't seem to find a way to set $_POST
to an empty array.
I have a form in phtml action to self I can get $_POST
values the following ways:
$this->getRequest()->getPostValue('form_key');
$this->getRequest()->getParam('form_key');
The Above will give Array ( [form_key] => FThdknnc_347djcncKey_)
Now I've tried to reset by doing:
$this->getRequest()->setPostValue('form_key');
But it gives me:
Array ([form_key] =>)
That ain't right browser still popping up saying that it will resend data from form: It should return Array ()
But the form_key key is still in the $_POST
Array. one can do in php:
$_POST = Array();
and that would be enough but it doesn't work with magento.
Anyone any idea?
forms magento2.2.2 post-data
I can't seem to find a way to set $_POST
to an empty array.
I have a form in phtml action to self I can get $_POST
values the following ways:
$this->getRequest()->getPostValue('form_key');
$this->getRequest()->getParam('form_key');
The Above will give Array ( [form_key] => FThdknnc_347djcncKey_)
Now I've tried to reset by doing:
$this->getRequest()->setPostValue('form_key');
But it gives me:
Array ([form_key] =>)
That ain't right browser still popping up saying that it will resend data from form: It should return Array ()
But the form_key key is still in the $_POST
Array. one can do in php:
$_POST = Array();
and that would be enough but it doesn't work with magento.
Anyone any idea?
forms magento2.2.2 post-data
forms magento2.2.2 post-data
asked Jul 12 at 11:11
Juliano VargasJuliano Vargas
7376 silver badges26 bronze badges
7376 silver badges26 bronze badges
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Try this:
/** @var ZendStdlibParametersInterface $postParameters */
$postParameters = $this->getRequest()->getPost();
$postParameters->fromArray([]);
Use getQuery
method to clean GET parameters.
add a comment |
You can try like this,
$formKey = $this->getRequest()->getPostValue('form_key');
unset($formKey);
than after you can try to set again
$this->getRequest()->setPostValue('form_key','your_value');
Hope it helps.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f281879%2fmagento-2-set-post-to-an-empty-array%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try this:
/** @var ZendStdlibParametersInterface $postParameters */
$postParameters = $this->getRequest()->getPost();
$postParameters->fromArray([]);
Use getQuery
method to clean GET parameters.
add a comment |
Try this:
/** @var ZendStdlibParametersInterface $postParameters */
$postParameters = $this->getRequest()->getPost();
$postParameters->fromArray([]);
Use getQuery
method to clean GET parameters.
add a comment |
Try this:
/** @var ZendStdlibParametersInterface $postParameters */
$postParameters = $this->getRequest()->getPost();
$postParameters->fromArray([]);
Use getQuery
method to clean GET parameters.
Try this:
/** @var ZendStdlibParametersInterface $postParameters */
$postParameters = $this->getRequest()->getPost();
$postParameters->fromArray([]);
Use getQuery
method to clean GET parameters.
answered Jul 12 at 12:11
Evgeny LevinskyEvgeny Levinsky
9251 gold badge4 silver badges11 bronze badges
9251 gold badge4 silver badges11 bronze badges
add a comment |
add a comment |
You can try like this,
$formKey = $this->getRequest()->getPostValue('form_key');
unset($formKey);
than after you can try to set again
$this->getRequest()->setPostValue('form_key','your_value');
Hope it helps.
add a comment |
You can try like this,
$formKey = $this->getRequest()->getPostValue('form_key');
unset($formKey);
than after you can try to set again
$this->getRequest()->setPostValue('form_key','your_value');
Hope it helps.
add a comment |
You can try like this,
$formKey = $this->getRequest()->getPostValue('form_key');
unset($formKey);
than after you can try to set again
$this->getRequest()->setPostValue('form_key','your_value');
Hope it helps.
You can try like this,
$formKey = $this->getRequest()->getPostValue('form_key');
unset($formKey);
than after you can try to set again
$this->getRequest()->setPostValue('form_key','your_value');
Hope it helps.
answered Jul 12 at 12:22
Mohit RaneMohit Rane
77416 bronze badges
77416 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f281879%2fmagento-2-set-post-to-an-empty-array%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown