In an Edit grid with Date Picker, when the date picker is clicked the hasChanged app variable sets to true even if the date is not changed.
Announcement
Collapse
No announcement yet.
hasChanged in Editgrid for Date Picker
Collapse
X
-
What we are trying to do is, we have a form and an edit grid which opens together. Changes made to the form and edit grid needs to be saved at once, hence we have an app level button which we need to disable when nothing is changed and should be enabled as soon as something changes either on form or on edit grid.
The problem we are facing is,
Forms hasChanged is already set to true as soon as it gets loaded. we have use program to load the form with keep data on show.
Editgrids hasChanged sets to true if we just click the date picker even if we do not change it.
??image.png?
Comment
-
We are calling a Program which sets field values using SetResponse('formFieldValue'
On Success, we show Form with Keep Data Option
We do this because, same field on the form may get data from different files based on certain conditions, handling that in a data source query makes the query too complex.
Same thing if we try using appVariable which is linked to General->Data in link to appvariable of the Form, where we set the appVariable to get all the data from the grid and then show the form using keep data. in this scenario the hasChanged property is not set to true
Comment
-
Not sure how to best handle this one. If we change the process so that setting a value of a form field does not trigger the hasChanged this will cause problems for those who rely on the fact that the field value has changed.
When using "data" linkage or reloading the form from the data source this resets the process because you are loading the entire record.
Comment
-
For now, can you try the following approach:- Add a new Event Listener named "resetFormHasChanged" or similar
- Add an "Execute Script" to this listener
Add a line of code to your form helper program:Code:setTimeout(function(){ setAppVar('YOUR_APP_VARIABLE':false); },500); success();
Code:SetResponse('fireEvent':'resetFormHasChanged');
Comment
-
This will be handled in the next update. There will be a new property that may be passed to SetResponse named "formFieldValueSilent". This update the value of the form field in a manner that the form will not recognize this field as being changed.
Code:SetResponse('formFieldValueSilent':'MY_FIELD':'MY_VALUE');
Comment

Comment