Просто хотелось указать, что встроенная функция sink
имеет хорошие примеры различных способов установки аргументов в функции:
> sink
function (file = NULL, append = FALSE, type = c("output", "message"),
split = FALSE)
{
type <- match.arg(type)
if (type == "message") {
if (is.null(file))
file <- stderr()
else if (!inherits(file, "connection") || !isOpen(file))
stop("'file' must be NULL or an already open connection")
if (split)
stop("cannot split the message connection")
.Internal(sink(file, FALSE, TRUE, FALSE))
}
else {
closeOnExit <- FALSE
if (is.null(file))
file <- -1L
else if (is.character(file)) {
file <- file(file, ifelse(append, "a", "w"))
closeOnExit <- TRUE
}
else if (!inherits(file, "connection"))
stop("'file' must be NULL, a connection or a character string")
.Internal(sink(file, closeOnExit, FALSE, split))
}
}
Если при установке disabled = "disabled" сразу после того, как пользователь нажимает кнопку, и форма не отправляется из-за этого, вы можете попробовать два things:
//First choice [given myForm = your form]:
myInputButton.disabled = "disabled";
myForm.submit()
//Second choice:
setTimeout(disableFunction, 1);
//so the form will submit and then almost instantly, the button will be disabled
Хотя, честно говоря, будет лучший способ сделать это, чем тот.