make_form now has a onsubmit option

This commit is contained in:
Daku 2011-12-29 22:55:44 +00:00
parent dc4d156e1a
commit dff1eef51a

View File

@ -254,13 +254,16 @@ function make_http($link) {
* *
* @retval string * @retval string
*/ */
function make_form($target, $method="POST", $multipart=False, $form_id="") { function make_form($target, $method="POST", $multipart=False, $form_id="", $onsubmit="") {
global $user; global $user;
$auth = $user->get_auth_html(); $auth = $user->get_auth_html();
$extra = empty($form_id) ? '' : " id='$form_id'"; $extra = empty($form_id) ? '' : " id='$form_id'";
if($multipart) { if($multipart) {
$extra .= " enctype='multipart/form-data'"; $extra .= " enctype='multipart/form-data'";
} }
if($onsubmit) {
$extra .= " onsubmit='$onsubmit'";
}
return "<form action='$target' method='$method'$extra>$auth"; return "<form action='$target' method='$method'$extra>$auth";
} }