Editor - serverside: How to fill a field with a value from a variable?
Editor - serverside: How to fill a field with a value from a variable?
JanNL_FR
Posts: 47Questions: 15Answers: 2
I am testing the duplicate example, so when I click "Create from excisting", I want to change a field value in to the value of a variable.
Is this possible?
var editor = new DataTable.Editor({
ajax: '../php/join.php',
fields: [
{
label: 'First name:',
name: 'users.first_name'
},
{
label: 'Last name:',
name: 'users.last_name'
},
{
label: 'Phone #:',
name: 'users.phone'
},
{
label: 'Site:',
name: 'users.site',
type: 'select'
}
],
table: '#example'
});
Jan.
This question has accepted answers - jump to:
Answers
The
field().val()
orval()
methods can be used to set a value for a field - e.g.:That value passed in can come from anywhere, including an Ajax data fetch if you need.
Allan
See "set" method below. If you want to use a variable for "Santa Claus" you could use a global variable unless the variable is just a different field of the same Editor.
Thanks, I used .set to fill it with a number
Jan.