Populate field based on ajax but don't submit it
Populate field based on ajax but don't submit it

Maybe the title is a little confusing, I am going to try to explain this as clear as possible.
Let's say I have a student table and a payment table.
Student's Table
ID | Name |
---|---|
1 | Yoko |
2 | Wasis |
Payment Table
ID | studentID | Payment |
---|---|---|
10 | 1 | 500000 |
11 | 1 | 250000 |
I hope you get the point.
Here is what I want to do.
In datatable Payment Table, when user click NEW, they can search the student's name (I can do this with select2 plugin). And when the user select the student's name, the field studentID will be populated based on the student's table. And when user submit the form, I don't want to submit the field Student's name.
Here is the form looks like :
Student's Name | Yoko (Searched using select2, don't get submitted to the server) |
---|---|
Student's ID | 1 (filled automatically based on student's name field) |
Payment | 5000000 (user put this manually) |
I hope it makes sense.
This question has an accepted answers - jump to answer
Answers
Bump. Any solution or work around is appreciated.
Yes - student 2 owes a small fortune!
Is your form using Editor? You an use
fields.submit
to indicate that a field shouldn't be submitted to the server (the student's name in this case). You might want to make that field areadonly
type as well.Allan
Thanks, got it.