Forums

How to trigger other events

ttomljen 25 Sep, 2013
hi

Besides the standard "form load" & "form submit" I would like to run another event ("submit 2").
I can add the event and run it but the actions are not run correctly.
For example: in default "form submit" actions like "DB_save" and "email" work fine, but when I copy paste the same actions into the new event("submit 2"), they run but they don't save anything to database and email fields are empty.

Any ideas?

thanks
GreyHead 25 Sep, 2013
Hi ttomljen,

There is technically no difference between the standard On Submit event and one you Add yourself so the actions should behave identically. Have you set them up correctly? For example the Email action is disabled by default?

Bob
ttomljen 25 Sep, 2013
thanks for a quick reply:

yes, I set them correctly, the second event ("submit 2") works OK in the sense it sends the email and makes a database record, but they are both empty(does not save records from the form).
Default submit normally saves into the database.

could it be because I trigger "submit 2" by making a menu which triggers event from "submit 2", is that the correct way to do it?
I also tried to add to the default form link plus "&event=submit2", but the result is the same.
GreyHead 25 Sep, 2013
Hi ttomljen,

Do you have a space in the event name? It needs to be submit2 or submit_2, not submit 2

Bob
ttomljen 25 Sep, 2013
the "submit 2" was just an example for easier communication, the event itself is called "close".🙂

the problem is not in the triggering of the event, the problem in "db_save" is the data is saved with empty values, and the same thing for "email".

I will send you link(via. P.M.) to the form, so you can check the debug, or I can give you admin access, if that will be required.

thanks
GreyHead 25 Sep, 2013
Hi ttomljen,

Thanks for the link. It looks as though you are using an SEF URL for the link - I suspect that may not be submitting to the event at all. In any case a button with a link on it won't submit the form data. It needs to be a proper submit button to so that (or a button input of type submit).

You can see what is being submitted from your browser web developer tools.

Bob
ttomljen 25 Sep, 2013
if I understand you correctly: the submit button I wrote manually won't work, so if I add the default submit button from elements, how to get it to trigger another event (for example in my case: event "close"), because by default, it will trigger "submit"?

thanks again
GreyHead 04 Oct, 2013
Hi ttomljen,

You can have more than one Submit button in a form and then check which one was used to submit the form. There are several ways to do this:

a) By checking the Value submitted for the button.

b) By giving the buttons array names like name='submit_btn[a]' and checking the key value after submission. This is useful if you want the same text shown on both buttons (i.e. the values are the same).

c) By using button inputs of type='submit' when you can assign values that are different to the text displayed on the button.

Bob
ttomljen 22 Nov, 2013
Sorry for the late reply: I'm still struggling with this issue.
I didn't understand your answer fully, so I will give you an example:

On webpage http://www.zci.hr/index.php?option=com_chronoforms&chronoform=example is a simple form with 2 input text fields.
This form has 2 submit buttons(submit and submit2) and 2 events(submit and submit2).
On both events I turned on the debugger.
When I click the first(default) submit I can see values entered for input_text_1 and input_text_2, but how to get the submit2 to trigger the event submit2 and collect values entered for input_text_1 and input_text_2?

thank you for your understanding.
This topic is locked and no more replies can be posted.