simsalabim/sisyphus

Hidden field changes are not triggering save

tameroski opened this issue · 4 comments

Hi,

I got a basic form with a text field and an hidden field, and my sisyphus timeout is set to 0.
When i change something to the text field, both fields values are saved. But that's not the case when i change the value of the hidden field.
Is there something i can do for this to work ?

Thanks

Here's how the plugin selects fields for monitoring, so your hidden field should fall into selection.

Save/restore operations are handled on "change" event happening, thus I would assume if you trigger change event on your hidden field it would solve your case.

facepalm
That did the trick, thanks !

Any example code? I am using Gravity Forms with conditional statements for UI and when a field is hidden, Sisyphus deletes the value.

To trigger the change event on your input, you can use :

if (document.createEvent) {
    var changeEvent = document.createEvent("HTMLEvents");
    changeEvent.initEvent("change", false, true);
    yourinput.dispatchEvent(changeEvent);
} else {
    yourinput.fireEvent("onchange");
}