Forums

CF8: Different submit actions depending on which button is clicked?

kgriffin 02 Aug, 2024

Hi-

I am rebuilding Chronoforms7 forms in Chronoforms8. I have a form that has different submit actions depending on the button clicked:

  1. TCPDF download
  2. Email user (this happens in 2 different places, sending out a different email depending on the button clicked)
  3. Upload file
  4. Update form

In Chronoforms7 I had a different page for each submit type and indicated the appropriate page for each submit button. In Chronoforms8, that is not how it works. I saw a forum post where PHP Events were used, but I don't think I am doing it properly, because no matter whether I just have a check for one submit button and create one event in the PHP action or include all the buttons and create a different event for each button I check, I keep getting NULL returned for the PHP action, therefore no Event is triggered.

Can you please tell me how to have multiple different submit buttons on a form each with different actions assigned to them?

Thanks.

kgriffin 03 Aug, 2024

Okay.

  1. For TCPDF download, I created the file on load of the form and stored it, and then created a HTML download link using the HTML Content View.
  2. Upload file and Update form is the same action: Save Data. So I just used the main submit action for these.

The only thing I have left is the two email actions. I am not sure how to go about doing this. Can I create a Submit button in a HTML Content View and specify the value for submit to another page? Anyone have a clue how to identify a page in a form in short code in Chronoforms8?

Max_admin 11 Aug, 2024
Answer

Hi kgriffin

Here is how to do this:

  1. Disable the Auto next page setting in your form
  2. add multiple pages with different features
  3. Add multiple submit buttons with different names in your form page
  4. in the "Submit" area of your first page, add a PHP action with Events behavior
  5. Setup multiple events based on your buttons, your PHP code should check which button name is set in the $this->data array and return an event name
  6. in each event you should use a "Set next page" action to direct your form to that page
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
You need to login to be able to post a reply.