Set field default on new record with JavaScript variable. This example returns
Set field default on new record with JavaScript variable. This example returns
How can I set the default field value using a JavaScript variable on a new records.
fields: [
{
label: "Location Code:",
name: "NWFF.MTSYS.MSLOC",
type:'readonly',
attr:{ disabled:true },
default: {userLocationCode; },
},
{
label: "System Code:",
name: "NWFF.MTSYS.MSCODE"
},
{
label: "Description:",
name: "NWFF.MTSYS.MSDESC"
},
{
label: "Date of Last PM:",
name: "NWFF.MTSYS.MSMLDT"
},
{
label: "Days to Next PM:",
name: "NWFF.MTSYS.MSDAYS"
}
]
This question has an accepted answers - jump to answer
Answers
Hi Bob,
Use
field.def
as a function. That way the function will be evaluated when the default value is required.edit - Example
Or if
userLocationCode
is static and won't change over the life time of the page:Allan
Thank you Allan. That is what I needed