1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice

Trigger some js on Reset form ?

Discussion in 'Community' started by lcollong, Jun 27, 2019.

  1. lcollong

    lcollong FabriKant d'applications web

    Level: Community
    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.
    Code (Javascript):

    requirejs(['fab/fabrik'], function() {
        Fabrik.addEvent('fabrik.form.reset', function(form){
            console.log('yeah !');
       });
    });
     
     
  2. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
  3. lcollong

    lcollong FabriKant d'applications web

    Level: Community
    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.
     
  4. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    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
     
    lcollong likes this.

Share This Page