Trigger some js on Reset form ?

lcollong

FabriKant d'applications web
Hi,

I have a search form with submit and reset buttons displayed.
Everything works as expected. The reset button "cleans" the fields to their original values.
But I need to do some other stuff (reset session vars) when clicking on the reset button.
I've added the following to a file named /js/form_xx.js where xx is my form id but it is never triggered.
Am I wrong ? Did someone succeed doing something similar ?
Any advice welcome.
JavaScript:
requirejs(['fab/fabrik'], function() {
    Fabrik.addEvent('fabrik.form.reset', function(form){
        console.log('yeah !');
   });
});
 
I'm not familiar with this. Here what I did :

turning on fabrik debug js to force using the non minified js file
load the page
set a breakpoint on the line (see capture)
reload the page
click on the reset button on the form
nothing happens.....

So, in order to check my setup, I added another BreakPoint on line 1375 (doSubmit) and when I click on the submit button, it halts on this line showing the object content and associated events.

So, if you are sure of the line number (it seems to have to deal with the group repeat staff), the answer is no. It's not running.
 
Hmm, yeah, looks like reset() isn't being called. And hasn't been called for quite some time - I went back to 2013 in git to try and find where we made changes.

I'm working on it.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top