it's not the first time that i get into trouble using $_post in a node form alter, this time i'd like some assistance.
basically, i need to pass some parameters to a form (and i should not pass the appended to the url, as query parameters). but $_POST values don't work as expected (they work until reaching validation phase).
So.. in a page i pass as hidden value
<form method="post" action="/node/add/">
<input type="hidden" name="mydesideredParameter" value="itsValue">
</form>
In the form_alter function of this form, at the very beginning, i try to assign this value to $form_state (and it works, I watchdog it later and it's correct)
if (array_key_exists('mydesideredParameter', $_POST)) {
$form_state['mydesiredConsequence'] = 'dance';
}
Later, inside form_alter, at the very end, i state:
if ($form_state['mydesiredConsequence'] === 'dance'){
$form['#validate'][] = 'myDancingFunction';
};
No complains happen on form building, but when trying to submit the form, the validation funcion doesn't get called and php complains about index that doesn't exist no more
Notice: Undefined index mydesiredConsequence
Nothing similar happens when i use this step and the values are in the url(via drupal_query_parameters) , but trying to make this work in $_POST seems a bit awkward. (i obviusly can imagine that the second form-rebuilding ignores $_POST, as it was a former request; but that should be the intended purpose of assigning the value to $form_state).