PDA

View Full Version : Form.updateRecord only works once?



tonyx
28 Sep 2011, 12:35 AM
I have a simple form. When the app starts up, I load a single record into it. There is a save button on the form that the user can click to save his / her changes. The even handler for clicking the save button is as simple as


if (form.isValid()) {
form.updateRecord(form.getRecord());

However, this seems to work only once. The first time user clicks the save button, all changes seems to be properly saved, however if the user were to click the save button, then nothing seems to happen whatsoever. Loading another record into the form and the loading the original one back seems to solve the problem, but there's gotta be a straightforward reason why updateRecord only worked once in the first place. Any ideas?

skirtle
28 Sep 2011, 2:48 AM
Shove in a breakpoint. The code for these methods is really simple so it should be pretty easy to find the problem.

bregard
12 Oct 2011, 12:41 PM
I have a simple form. When the app starts up, I load a single record into it. There is a save button on the form that the user can click to save his / her changes. The even handler for clicking the save button is as simple as


if (form.isValid()) {
form.updateRecord(form.getRecord());

However, this seems to work only once. The first time user clicks the save button, all changes seems to be properly saved, however if the user were to click the save button, then nothing seems to happen whatsoever. Loading another record into the form and the loading the original one back seems to solve the problem, but there's gotta be a straightforward reason why updateRecord only worked once in the first place. Any ideas?

Hi... any more news on this? Did you find a solution?

codeart.ch
13 Oct 2011, 10:52 AM
var record = this.getForm().getRecord();
if(record) {
this.getForm().updateRecord(record);


Compare your code to mine. The only difference i see is that i use the getForm() method.

Does it works if you add this too ?


greetings