Commit 7a2754e2 7a2754e249de6982622a18bd34ea13961d53e649 by Nicolas Perriault

fixed #117 - fill() cant submit a form with a submit input named "submit"

1 parent fd9956c5
......@@ -531,7 +531,12 @@ Casper.prototype.fill = function fill(selector, vals, submit) {
var method = (form.getAttribute('method') || "GET").toUpperCase();
var action = form.getAttribute('action') || "unknown";
__utils__.log('submitting form to ' + action + ', HTTP ' + method, 'info');
form.submit();
if (typeof form.submit === "function") {
form.submit();
} else {
// http://www.spiration.co.uk/post/1232/Submit-is-not-a-function
form.submit.click();
}
}, { selector: selector });
}
};
......
......@@ -19,7 +19,7 @@
<input type="checkbox" name="checklist[]" value="1" />
<input type="checkbox" name="checklist[]" value="2" />
<input type="checkbox" name="checklist[]" value="3" />
<input type="submit"/>
<input type="submit" name="submit" value="submit" />
</form>
</body>
</html>
\ No newline at end of file
</html>
......