Looking through the docs, it is very clear that in the task edit menu if you set the name to the actual name of the field, it will render the value automatically. This is what I am referring to :
newTabField : {
type : 'textfield',
weight : 710,
label : 'New field in New Tab',
// Name of the field matches data field name, so value is loaded/saved automatically.
// In this case it is equal to the Task "name" field.
name : 'name'
}
My question is: How can I grab the value for a tab field of type 'Button'?
I tried setting the same name, but only static 'name' comes back, not the actual field value: name.
My goal is to pass a url to this button to redirect users back to the task in our external system.
The values from the fields of a record are distributed into child widgets in the editor where the name of the widget matches the name of the field. But the widget has to have a value property - it sets the value.
A Button doesn't have a value property.
I think we can fix this with a small augmentation of the Container class.
The setting of record values into child widgets should really use this property. It defaults to value, but it should use the name specified by that property. When we fix this, your button could set it to the nae of some other config.
So here after applying it still does not operate as intended. I used a textField to ensure the field has a value and it does prove correct.
ReturnButton: { // this one still does not dynamically load the value from 'returnToQB'
type: 'button',
defaultBindProperty : 'textfield',
flex: '1 0 50%',
// text: 'returnToQB',
weight: 710,
htmlEncode: false,
value: 'returnToQB',
// Name of the field matches data field name, so value is loaded/saved automatically
name: 'returnToQB',
// text: 'returnToQB',
// href: 'returnToQB'
onClick: function (value) { alert(value) }
},
testButtonURLField: { // this one does dynamically load the value from 'returnToQB'
type: 'textfield',
weight: 710,
label: 'TEST',
// Name of the field matches data field name, so value is loaded/saved automatically
name: 'returnToQB',
},
Please note the ticket is not yet resolved, you can see above its state is "Ready for review". Once it says Resolved you can grab it from the nightly build to try it out.
So when I pull the new version. Here is my new button object:
taskEdit: {
items: {
generalTab: {
items: {
returnField: { // does not work
type: 'button',
defaultBindProperty: 'text',
flex: '1 0 50%',
weight: 710,
htmlEncode: false,
// Name of the field matches data field name, so value is loaded/saved automatically
name: 'returnToQB',
onClick: function (value) { console.log(value) }
},
testButtonURLField: { // works
type: 'textfield',
weight: 710,
label: 'TEST',
// Name of the field matches data field name, so value is loaded/saved automatically
name: 'returnToQB',
},
The button still does not have a dynamic name, yet the text field below it has the value and works. Any suggestions?