For pset8 finance check 50 is showing errors stating

:( quote page has all required elements expected button to submit form, but none was found

The html template and source have a button element, and this looks exactly the same as the staff solution except for the placeholder text.

<form action="/quote" method="post">
    <div class="form-group">
        <input autocomplete="off" autofocus class="form-control" name="symbol" placeholder="Stock symbol" type="text">
    <button class="btn btn-primary" type="Submit">Quote</button>

The buy form has a similar error showing in check50, but has a button and has similar html and template code.

Functionally everything works, and as far as I can see all elements are present.

The application.py code is

def quote(): """Get stock quote."""

# User reached route via POST (as by submitting a form via POST)
if request.method == "POST":

    # Ensure stock symbol was submitted
    if not request.form.get("symbol"):
        return apology("must provide a stock symbol", 403)

    # Lookup stock price
    quote = lookup(request.form.get("symbol"))

    # Ensure symbol is a valid stock symbol
    if not quote:
        flash("Please enter a valid stock code")
        return redirect("/quote")

    # Convert price to show as USD
    quote['price'] = usd(quote['price'])

    # Redirect user to quoted page, passing the quote to the page.
    return render_template("quoted.html", quote=quote)

# User reached route via GET (as by clicking a link or via redirect)
    return render_template("quote.html"), 200

Has anyone else experienced this, am I missing something really obvious?


Those strings are case-sensitive. Instead of type="Submit", use type="submit".

It still works, because "submit" is the default type for buttons. Quoting https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button


The default behavior of the button. Possible values are:

  • submit: The button submits the form data to the server. This is the default if the attribute is not specified, or if the attribute is dynamically changed to an empty or invalid value.
  • reset: The button resets all the controls to their initial values, like <input type="reset">.
  • button: The button has no default behavior and does nothing when pressed. It can have client-side scripts associated with the element's events, which are triggered when the events occur.

In this case, "Submit" with upper-case S would be invalid. But the checker doesn't check for this kind of default, it expects a proper type="submit".

  • Thank you. That fixed the issue. – jeffcnz Aug 24 '19 at 20:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .