3
I have a form field that receives a value inteiro, this field in the form has the function OnKeyPress, I need the user to enter some value this value goes to the for ex: the user has typed 5, the for goes from 0 a 4
My role in JavaScript:
function key_press(e) {
  for (var i = 0; i < e; i++) {
    $("#gridContainer2").dxDataGrid("addRow");
  }
}
My form:
@(Html.DevExtreme().Form<FormaPagamentoViewModel>()
    .ID("formularioCadastro")
    .ShowValidationSummary(false)
    .Items(items =>
    {
       items.AddGroup()
       .Items(groupItems =>
       {
         groupItems.AddSimpleFor(m => m.Fpg_quantidade)
         .Editor(e => e.NumberBox().Width("70px").OnKeyPress("key_press"));//Campo que o usuário ira preencher
    });
    })
    .FormData(Model)
    )
						
And what’s the mistake?
– Leandro Angelo
In vdd the error is that my for I n to passing the entered value, I am passing only the "e", but I testing discovered a solution
– Jeff Henrique
I should have commented on the part that needs change, sorry my mistake, but obg
– Jeff Henrique
There is no way instead of onKeyPress, put
.OnKeyUp("key_press(this)")?– Sam
Yeah, there’s a way, it even looks better to use
– Jeff Henrique
But I don’t quite understand the difference between the two
– Jeff Henrique