• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Script called on form process - every page break

Script called on form process - every page break 10 months 2 weeks ago #43516

Hi,

I have 2 pagebreaks fields and a final submit button on my form.

I have a script called on form process that creates a file. The issue I have is that the file is created 3 times because the script is called at every page break and the final Submit. I want the file to be created only when the Submit button is pressed. The file will be used in the User email.

How can I identify the third occurrence to trigger the php creation of the file?
The administrator has disabled public write access.

Script called on form process - every page break 10 months 2 weeks ago #43519

  • andreic
  • andreic's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 745
  • Thank you received: 66
Hello,

This is caused by the fact that you have the "Validate When Changing Page?" option set to "Yes". This will performed a validation for the page fields using an AJAX call, the "Scripts called on form process" will also be triggered on this call.
In order to avoid this when changing pages there's an $isAjax variable available, you can try adding an if clause to the script used to generate the file:

if(!$isAjax && !$invalid) {

// .. your file generating script here

}

This way the script will be triggered only when the submit button is used and no validation errors are encountered.

Another option would be to move the script that generates the file from the PHP Scripts > Scripts called on form process area to the PHP Email Scripts > Script called before the User Email is sent., this way the script will only be triggered when the user email is sent out. You can read more on this scripting area here:
www.rsjoomla.com/support/documentation/r...p-email-scripts.html
Please note: my help is not official customer support. To receive your support, submit a ticket by clicking here
Regards,
RSJoomla! Development Team
Last Edit: 10 months 2 weeks ago by andreic.
The administrator has disabled public write access.
The following user(s) said Thank You: roland.bialobroda

Script called on form process - every page break 10 months 2 weeks ago #43524

I've used your second option. Thanks a lot.
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!