• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

add a delay before form submit

rongame

Member
hi

i have a fabrik event that will submit form after an autofill is finished.

i would like to add 5 sec delay before a form submits. can anyone please assist me.

JavaScript:
window.addEvent('fabrik.loaded', function () {
   Fabrik.addEvent('fabrik.form.autofill.update.end', function (form, json) {
      form.form.doSubmit(new Event.Mock(form.form._getButton('Submit')), form.form._getButton('Submit'));


   });
});

any assistance is appreciated

thank you
 
I think ...

JavaScript:
window.addEvent('fabrik.loaded',function(){
   Fabrik.addEvent('fabrik.form.autofill.update.end',function(form, json){
      setTimeout(
         form.form.doSubmit,
         5000,
         new Event.Mock(form.form._getButton('Submit')),
         form.form._getButton('Submit')
      );
   });
});

-- hugh
 
Well at the moment you've got all that code commented out. You have an opening comment, /*, on line 1, and it doesn't get close with */ till line 53.

-- hugh
 
hi hugh

thank you for your time

i was testing a few js that i would like to add to the page.

please check now

BTW im using some other codes to hide an element id and to display a timer . i dont know if this is related but all of this is not working when i place the code you have given me.

thanks again
 
Last edited:
OK, I'm going to need to be able to edit that file. Can you provide me either with backend credentials and install exTplorer, or give me an ftp login.

-- hugh
 
OK, should be working now. The code that worked was:

JavaScript:
//auto submit woth timer
requirejs(['fab/fabrik'],function(){
   Fabrik.addEvent('fabrik.form.autofill.update.end',function(form, json){
      setTimeout((
         function() {
            form.form.doSubmit(new Event.Mock(form.form._getButton('Submit')), form.form._getButton('Submit'));
         }.bind(form)),
         5000
      );
   });
});

I don't know why form_3.js got emptied, presumably something to do with whatever permissions issue or problem prevented me from saving the file. Luckily I still had a browser page and dev tools window open on it, and was able to recover a copy of the file from that.

The index.html file is supposed to be empty. It's just there to prevent accidentally allowing directory browsing.

-- hugh
 
great its working.

in connection to the delay i would like to add a timer. something like you have 5, 4 3 2 1 secs to choose. i found the timer plugin but its not really what i need.

any suggestions?

thank you again
 
If the timer plugin doesn't do it (and yeah, that's a count up, not a count down) you'd have to add some custom JS to do it.

And that's definitely straying into Pro support territory. I already went above and beyond Standard by getting hands-on with fixing this code for you.

-- hugh
 
thank you hugh,

i understand completely and i really appreciate the efforts you have done for me.

i'll try to sort things out first then i'll probably get back to you on that

again thank you.
 
hi hugh

in connection to this,every time i use the autofill part of the form and it has done loading or performing search it will always do the search again if i click on any part of the from. This is regardless of a match has been found or not. if i have not use the autofill clicking on any part of the form does not trigger any performing search activity.

can you give me a clue on what to do? i already disabled the js and its still does the performing search thing. i also cleared cache

thanks
 
Yeah, I can duplicate the "double lookup", when using an auto-complete database join as the autofill field. But trying to debug it is tough, as it's very difficult to debug event driven issues. I think it's something to do with clicking on the dropdown that the auto-complete join creates fires a blur, then when the auto-complete inserts the selection into that field, it focuses again, so clicking anywhere else causes another blur.

The only immediate workaround would be to get rid of the confirmation dialog, and just let it do it's thing twice - won't hurt anything. or use a "trigger" element - create a button element, called something like "Start" (or whatever), and specify that as the autofill trigger. Then you won't get those blur events firing anything.

-- hugh
 
hi hugh

i tried what you recommended and added a trigger. im still getting the "double lookup" issue.

what can we do so that when an actual search is being made it only searches when the trigger button is clicked.

What happens is when i use the auto-complete database join as the autofill field it triggers a search to check if the records is available and alerts if no record is found. When i click the trigger it performs the autofill.

Can we make it search and perform the autofill once the trigger is clicked? to make it more logical i guess

thanks again
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top