I'm developing a question type and in my question edit form the number of answers is flexible, similar to MC questions. Currently, I realise a change in the number of answers by submitting the form, after changing the number of options (a change via JS AJAX was very difficult because the editors have to be rendered, initialised, etc).
When a question preview window is open, that window should be updated/reloaded after changing the number of options (i.e. after submitting the form and a page reload).
My first try was to override the preview button/link and do
var previewWindow = window.open(previewUrl, 'PreviewQuestion', 'height=620,width=750');
after the page reload I do
var existingWindow = window.open('', 'PreviewQuestion');
I tried to add a hidden field "previewopen" to the form and set it's value with JS.
However, the value doesn't seem to be in the submitted data (maybe because it only takes the fields that are actually in the $question object?).
Has anyone an idea how I could implement the feature that the preview window always shows the current state of the question as it is stored in the database?