Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 381965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T15:08:12+00:00 2026-05-12T15:08:12+00:00

Drupal inserts a form_token as a hidden field when it renders forms. The form_token

  • 0

Drupal inserts a form_token as a hidden field when it renders forms. The form_token is then checked on form submission to prevent cross-site request forgery attacks. The form data that is submitted is guaranteed to have come from the original form rendered by Drupal.

However, forms using the “GET” method shouldn’t need this token. All it does is lengthen and uglify the resulting URL.

Is there any way of suppressing it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T15:08:12+00:00Added an answer on May 12, 2026 at 3:08 pm

    Yes, there is a way, but use it consciously (see warning below):

    If you create the form yourself, adding

    $form['#token'] = FALSE;
    

    to the form definition array should prevent a token from being generated in the first place.

    If you are dealing with an existing form, you can bypass the token validation process by unsetting the ‘#token’ element on hook_form_alter:

    // Example for removal of token validation from login (NOTE: BAD IDEA!)
    function yourmodule_form_alter(&$form, &$form_state, $form_id) {
      if ($form_id == 'user_login_block') {
        unset($form['#token']);
      }
    }
    

    Warning: Given your question, I think there is a slight misconception concerning the difference (better, the lack of a difference) between GET and POST requests.

    … on forms using the “GET” method
    shouldn’t need this token. All it does
    is lengthen and uglify the resulting
    URL.

    This is wrong! GET and POST are just two different, but mostly equivalent methods of transmitting data from the client to the server. Since POST is better suited to transfer large amounts of data (or difficult formatted data), it is the established standard for submitting forms, but it is in no way safer/unsafer or more/less secure than GET requests. Both type of requests can be tampered with by malicious users in the same ways, hence both types should use the same protection mechanisms.

    With a GET request, the token does exactly the same as with a POST request – it proves to the server that the submitted data comes from the same Browser on the same machine as the request he build the form for! So you should only remove it if you are sure that the request can not be misused via XSRF.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 202k
  • Answers 202k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer That's right. Five people can win, there are 3215 entrants,… May 12, 2026 at 8:26 pm
  • Editorial Team
    Editorial Team added an answer Assuming you mean the SPWebApplicationBuilder class. Have you tried to… May 12, 2026 at 8:26 pm
  • Editorial Team
    Editorial Team added an answer I don't think there's much point in returning a new… May 12, 2026 at 8:26 pm

Related Questions

I'm trying to implement #field_prefix on a text field so I can add some
I have a bookmarklet which inserts a CSS stylesheet into the target DOM via
I'd like my primary links in Drupal to look like this in code: <a
I'm using Drupal 6.x and I'm writing a php class that will grab an
In Drupal, if you want to insert something into the node table, 'nid' can

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.