TOPIC:

submitting the second form, 1 month 17 hours ago #242200

  • Topic Author
  • DAVIDPL
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 75
  • Thanks: 0
Hi
I would like that when the form starts.

If the remesa field is empty, open a new popup form without closing the current one

And then after filling and submitting the second form, automatically update the first one.

code:
Scripts
Initialization Script

function ff_Asignar_remesa_licencia_init()
{ setInterval(calc, 500);
} // ff_Asignar_remesa_licencia_init

function calc() {

var a3 = ff_getElementByName('Remesa').value;


if(a3 == "") {alert("!Es necesario que cree una nueva remesa para seguir con el proceso!");
window.open('/index.php?option=com_breezingforms&view=form&Itemid=697');
}
} // ff_Asignar_remesa_licencia_init


This code repeatedly loops the form indefinitely, something is wrong

Please Log in or Create an account to join the conversation.

submitting the second form, 1 month 14 hours ago #242208

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 9069
  • Karma: 167
  • Thanks: 737
Hi,

it loops because every 500ms the window is opened.
You need to disable the interval once the window opened:
let bf_calc_interval = null;

function ff_Asignar_remesa_licencia_init()
{ 
   bf_calc_interval  = setInterval(calc, 500);
} // ff_Asignar_remesa_licencia_init

function calc() {

   var a3 = ff_getElementByName('Remesa').value;

   if(a3 == "") {

      // stop the interval to stop looping
      clearInterval(bf_calc_interval );

      alert("!Es necesario que cree una nueva remesa para seguir con el proceso!");
      window.open('/index.php?option=com_breezingforms&view=form&Itemid=697');
   }
} // ff_Asignar_remesa_licencia_init

Regards,
Markus

Please Log in or Create an account to join the conversation.

submitting the second form, 1 month 14 hours ago #242211

  • Topic Author
  • DAVIDPL
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 75
  • Thanks: 0
Hi


The code works perfectly
I have added a popup.

It only needs to automatically update the first form when the second form is closed

code:

window.open('/index.php?option=com_breezingforms&view=form&Itemid=697', "_blank", "toolbar=yes,scrollbars=yes,resizable=yes,top=500,left=500,width=400,height=400");
Attachments:

Please Log in or Create an account to join the conversation.

submitting the second form, 1 month 13 hours ago #242215

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 9069
  • Karma: 167
  • Thanks: 737
In your form that opens in the popup, create a custom init script in form => advanced => more options and click "create code framework".

Inside the generated function, between { and } try this:
window.onclose = function(){
     
    window.opener.ff_getElementByName("FIELDNAME-OF-PARENT-FORM").value = ff_getElementByName("FIELDNAME-OF-POPUP").value;
   
};

I didn't test it and it might not work right away, but in principle it should work using with opener. Maybe you will have trouble reaching "window.opener.ff_getElementByName", so please make sure to open the browser console to spot errors upon closing the popped up window.

Regards,
Markus

Please Log in or Create an account to join the conversation.

submitting the second form, 1 month 13 hours ago #242221

  • Topic Author
  • DAVIDPL
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 75
  • Thanks: 0
Hi

The received code is not functional


Could another method be used?

1.-That the first form is closed when calling the second form.

2. From the second form at the end of the submission, make a call to the first form to open it again.

Please Log in or Create an account to join the conversation.

submitting the second form, 1 month 11 hours ago #242235

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 9069
  • Karma: 167
  • Thanks: 737
Chrome won't allow closing the opener without closing the opened, too.
Let me try something.

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
  • 2
Moderators: ForumSupport
Time to create page: 0.053 seconds

July Sale!

Discounts for all of our extensions + support. Ending July 31st!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!