title: How to read hidden form data in Flask function
body: <p>I am working on an assignment for a Flask application with a function that does different things based on the value of a hidden field in a form on the index.html page. I am to have only two routes: '/' (index.html) and '/process' (which performs actions on index.html).</p>
  
  <p>When I run this in Flask (python server.py in a virtualenv), and click the button "Make Money" on index.html, I get this error:</p>
  
  <p>"TypeError
  TypeError: 'ImmutableMultiDict' object is not callable"</p>
  
  <p>Can someone please tell me how I can get the desired value from the hidden input?</p>
  
  <p>contents of server.py</p>
  
  <pre><code>import datetime
  import random
  from flask import Flask, render_template, redirect, request, session
  
  app = Flask(__name__)
  app.secret_key = 'fooBarBaz'
  
  @app.route('/')
  def index():
      return render_template('index.html')
  
  @app.route('/process', methods=['GET','POST'])
  def process():
      if request.method == 'POST':
          target = request.form('name')
          if target == 'clothing':
              new_money = random.randrange(10, 21)
              session['balance'] += new_money
              timestamp = datetime.datetime.now()
              session['register'] += ("Received" + new_money + " dollars at " + timestamp.strftime("%Y/%m/%d %I:%M %p")) 
          return render_template('index.html')
  
  app.run(debug=True)
  </code></pre>
  
  <p>contents of index.html:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
      &lt;meta http-equiv="X-UA-Compatible" content="ie=edge"&gt;
      &lt;title&gt;Document&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div container&gt;
          &lt;div class='balance'&gt;
              &lt;p&gt;Your balance:  {{ session['balance'] }}&lt;/p&gt;
          &lt;/div&gt;
          &lt;div class="shops"&gt;
              &lt;div class="clothing"&gt;
                  &lt;h2&gt;Clothing Store&lt;/h2&gt;
                  &lt;p&gt;(earns 10 - 20 dollars)&lt;/p&gt;
                  &lt;form action="/process" method="post"&gt;
                      &lt;input type="hidden" name="clothing"&gt;
                      &lt;input type="submit" value="Make Money!"&gt;
                  &lt;/form&gt;
              &lt;/div&gt; 
          &lt;/div&gt; 
          &lt;div class="register"&gt;
              &lt;h4&gt;Receipt Tape&lt;/h4&gt;
              &lt;p&gt;{{ session['register'] }}&lt;/p&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>