Page 1 of 1

[javascript] bug? app.execDialog() erratic result from dialog.store() for 'edit_text'

Posted: Mon Dec 02, 2024 6:20 pm
by Mathew
When using an edit_text box with PopupEdit: true the information provided to the change event is erratic. Sometimes it provides the most recent change, but sometimes it doesn't update. Sometimes the change event happens twice for one change, sometimes once.

To reproduce:

Code: Select all

// test of input box

{
    const inputTest = {
        initialize() {
        },
        commit() {
        },
        txB1(dialog) {
            console.println( JSON.stringify( dialog.store()));
        },
        description: {
            name: "Edit text box", // Dialog box title
            elements:
            [{  type: 'edit_text', width: 300, item_id: 'txB1', PopupEdit: true
            },
            {   type: 'ok'}
            ]
        }
    };
    
    app.execDialog(inputTest);
}
The text box is already selected, so start typing 12345 then use backspace to delete the numbers one at a time, the console shows:

Code: Select all

{"txB1":""}
{"txB1":""}   // text box actually contains 1
{"txB1":"1"}
{"txB1":"12"} // it caught up to 12
{"txB1":"12"}
{"txB1":"123"}
{"txB1":"123"}
{"txB1":"1234"}
{"txB1":"1234"}
{"txB1":"12345"} // 12345 (it stayed caught up, the event happening twice for each keystroke with the data provided first the value before the keystroke, then after)
{"txB1":"12345"} // 1234 (deleting it's showing the old data and only firing the change event once)
{"txB1":"1234"} // 123
{"txB1":"123"} // 12
{"txB1":"12"} // 1
{"txB1":"1"} // empty 
It's quite erratic. Sometimes it gets the most recent change, sometimes it doesn't.

Re: [javascript] bug? app.execDialog() erratic result from dialog.store() for 'edit_text'

Posted: Tue Dec 03, 2024 12:12 pm
by Stefan - PDF-XChange
Hello Mathew,

Thanks for reporting this! I've asked a colleague working on the JS engine to take a look here and advise.

P.S. Our devs just confirmed that they are already working on this. So I expect the fix to be in the next build, but will await their confirmation before stating it with certainty :)

Kind regards,
Stefan