I'm trying to get the value of an input hidden inside the Controller by FormCollection, but the value is zeroed. To increase the value, I'm using a JavaScript function.
HTML:
<form id="adicionarTituloManual" action="~/Movimento/AdicionarCodevedoresTit" method="post">
<input type="hidden" id="qtd" name="qtd" value="" />
</form>
Javascript:
function novo(i)
{
var form, quant;
var qtd = document.getElementById('qtd').value
if (qtd == 0) {
document.getElementById('qtd').value = i;
}
else{
i = parseInt(document.getElementById('qtd').value) + 1;
document.getElementById('qtd').value = i;
}
}
Controller:
public ActionResult AdicionarCodevedoresTit(FormCollection formCollection)
{
if (Session["usuario"] == null)
{
return Redirect("~/Home/Index");
}
else
{
this.usuario = (STLoginUsuario)Session["usuario"];
}
int qtd = HUtils.ConverteEmInteiro(formCollection["dvQtd"]);
return Redirect("~/Movimento/AdicionarCoDevedor");
}