user3837956
user3837956

Reputation: 67

Python Bottle Not Going Through Post

I am trying to make a web program with multiple pages and nothing in the post statement is going through

  @bottle.route('/ecoedit/<whole_number>')
def ecoedit(whole_number):
 #add method="post" to form action = "/..." when appropriate
 return '''
<html>
    <head>
        <title>ECO Editor</title>
    </head>
    <body>
        <h1>ECO Editor</h1>
        <form action="/ecoedit/%(x)s" >
            <p>Revision Number</p>
            <p> <input name="RevNumber" type="text"/> </p>
            <h3>Change Specifications</h3>
            <input type="radio" name="ChangeLocation" value="BOM">BOM
            <input type="radio" name="ChangeLocation" value="Netlist">Netlist<br>
            <input type="radio" name="ChangeType" value="Add">Add
            <input type="radio" name="ChangeType" value="Change">Change
            <input type="radio" name="ChangeType" value="Remove">Remove<br>
            <button>Submit Changes</button>
        </form>

    </body>
</html>
'''% {"x" : whole_number}
@bottle.post('/ecoedit/<whole_number>')
def ecoedit(whole_number):
  print 'hello'
  ChangeLocation = post_get('ChangeLocation')
  print ChangeLocation

The webpage appears but after clicking submit absolutely nothing happens in he console not even e print hello. Can anyone tell me why this is happening

Upvotes: 1

Views: 81

Answers (1)

Andrew Johnson
Andrew Johnson

Reputation: 3186

Change your form tag to

<form action="/ecoedit/%(x)s" method="POST">

that will send the form request as a POST instead of default GET.

Note: this crashes for me because post_get is not defined, but that may be defined in your code.

Upvotes: 1

Related Questions