Assign a value to a field before sending
Assign a value to a field before sending
klermann
Posts: 277Questions: 67Answers: 1
Hi, How do I assign a value to a field before sending to the server?
This discussion has been closed.
Answers
field().val()
is the API method to use.Allan
Where can I use this code snippet with the changes to my field??
editor
.edit( row, false );
.val( 'contaA', 'Conta A' );
.val( 'contaB', 'Conta B' );
.submit();
Wherever it is that you want to change the values of those two fields. I would not that you have a syntax error (
.val
is not valid withouteditor
in front of it). You also need to define what therow
variable is.Allan
Hello, I was able to solve the first problem. Now I just need to retrieve, retrieve, retrieve, the value of "Conta Atual" that comes from the table to be seated in the second select that is with the "Selecione a conta B" placeholder, that when I open the editor it is empty, without the value for to edit!
ec2-54-157-236-83.compute-1.amazonaws.com:8080/financeiro/transferencias/
Same issue as before . You are using
minhasContas[].nome
which resolves to "Conta B" for example, but the select list doesn't contain that value:It contains ids.
minhasContas[].id
is what you need, but you already have that. I don't understand why the same field is shown twice?Allan
Allan, are exactly two fields that need transactions, transfers between accounts. Withdraw from one account and transfer to another.
In the first field I get the value correctly, but in the second no!
How are you storing them in the database? Are they in two different columns?
Allan
In my database I have tranferencias that have the columns contaA and contaB that relates to minhasContas, that has the lines contaA and contaB
Okay, so I'm still not understanding I'm afraid. If you have the columns
contaA
andcontaB
in the database table, why not set the names for the fields to match that?Allan
why do I need the options to be loaded into a list and when I edit it gets the contaA in list 1 and contaB in list 2
I don't know. Why do you?
If your fields are simply
contaA
andcontaB
I would expect the JSON to contain the values for those data points in the database, and also the joined table information for those two fields so you can display them in the table.Allan
I did not quite understand his position, and what he meant. I'll explain better. Point 1. The Conta anterior value of the table is already being received and loaded in list 1 (A), in the first list of the editor as you can see in the images. OK. Point 2. The Conta atual value is NOT being received in the editor's list 2 (B) as you can see in the images and url I sent. How do I receive the Conta atual value properly from the table in list 2 (B) of the editor?