using $_POST values in form alter to add validation


You should use $form_state['storage']. This will cache your data and make it available throughout the forms lifecycle.

Tags: Drupal 7 / Forms

Similar questions

How to get $_POST and $_GET parameters
I ajaxly call a route and pass data to it, In my controller, I want to get $_POST['var'] , $_POST['var2'], it seems because of using HttpFoundation in drupal 8, $_POST and $_GET are not exists in old method, How I can access $_POST parameters in custom Controller?
Getting $_POST empty in AJAX callback
I just want to send address information to drupal for check content existence through the AJAX. Request is sending successfully and callback function also executing. but I am not getting any data in $_POST array. here is my AJAX code. This is callback routing & function At where I am making mistake? is there any other way? Or is there any probl...
D8 | submitForm | Get the $_POST - vars via $form_state or via \Drupal::request()?
On an regular sumbmitForm function, should I fetch the user input via \Drupal::request()->request->get... or is $form_state->getValues(); the better (more saver) way? thx
$_POST undefined from remote server POST
I am writing a Drupal 7 module which is listening for HTTP POST messages to be sent by a 3rd party remote application. For testing I am sending messages using the Firefox Poster extension. If I POST the message, the following code fails to place any value in my local vars (I get 'undefined index'): However, if I send the message using GET, the vars...
Passing $_POST data from page to page in Drupal
Does anyone know how to transfer $_POST data (HTML form data) from one page to another in Drupal? I have two PHP pages I'm including in two different Drupal nodes, but I can't pass POST data between them. Is there an easy way to do this?
drupal_mail - Need to Remove $_POST
I am new to the drupal_mail function and need help. The code I have works, but I want to get rid of the $_POST parameter to limit my security holes. I don't know how to get the posted variables without using the $_POST parameter, and ideally, I would like to single each parameter out to put a custom label on it. Any help would be greatly appreciate...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.