Reputation: 5201
I think this one is a really easy one for many out there, but I actually do not get why my script isn't working, well Im new on this so if someone out there the answer, I would be happy.
The form simply takes one param and posts it to the same form on the same page, but for now when the page reloads the param doesn't show, I don't know if it is the python thats wrong or weather it is the html, anyway I have no idea as I don't get any error messages...
import webapp2
form="""
<h2>Enter some text</h2>
<form method="post">
<textarea name="text" value=%(word)s style="height: 100px; width: 400px;">
</textarea>
<br>
<input type="submit">
</form>
"""
class MainHandler(webapp2.RequestHandler):
def write_form(self, text=""):
self.response.write(form % {"word": text})
def get(self):
self.write_form()
def post(self):
text=self.request.get("text")
self.write_form(text)
app = webapp2.WSGIApplication([('/', MainHandler)], debug=True)
Upvotes: 1
Views: 129
Reputation: 142106
textarea
s don't have a value attribute - instead the content should be inside the textarea
open/close tag.
eg:
<textarea>%(word)s</textarea>
It's worth looking into templating though, but you mention that may be coming up further in your tutorial so...
Upvotes: 1