Skip to content

Commit

Permalink
If Button tag has no type, assume the type of it is 'submit'.
Browse files Browse the repository at this point in the history
According to <https://developer.mozilla.org/nl/docs/Web/HTML/Element/button>:

+ The type 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.
    + button: The button has no default behavior. It can have client-side scripts associated with the element's events, which are triggered when the events occur.
    + menu: The button opens a popup menu defined via its designated <menu> element.

So, we can treat the button tag with no type specifed as a submit tag.

Thanks Vincent Wagelaar <[email protected]> emailing me about this patch.
  • Loading branch information
shunyi authored and shunyi committed Nov 6, 2016
1 parent babf6dd commit 9df767b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion robobrowser/forms/form.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def _parse_field(tag, tags):
return fields.Checkbox(checkboxes)
return fields.Input(tag)
if tag_type == 'button':
tag_type = tag.get('type', '').lower()
tag_type = tag.get('type', 'submit').lower()
if tag_type == 'submit':
return fields.Submit(tag)
return fields.Button(tag)
Expand Down

0 comments on commit 9df767b

Please sign in to comment.