Skip to Content Skip to Menu

Apply a trigger to submit button

  • dotcom22
  • dotcom22
  • OFFLINE
  • Posts: 522
  • Thanks: 14
  • Karma: 4
10 years 6 months ago #243722 by dotcom22
Apply a trigger to submit button was created by dotcom22
I wondering if is possible to apply a specific CB trigger to a standard html submit button. I would like put inside an article this button, then when user click on it to produce an event which can be used inside Auto-Action as a trigger.

I could of course use an existing trigger such onAfterUserUpdate or any other but this require to interact with CB. My goal is to be "outside" CB for produce my "one click event" but to still be able to benefit the power of Auto-Action.

any clue ?

I use Joomla 3.3.6 - CB 2.0.4 - CBSubs 4 - Several Incubator plugins

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48478
  • Thanks: 8282
  • Karma: 1443
10 years 6 months ago #243804 by krileon
Replied by krileon on topic Apply a trigger to submit button
No, not without using PHP to fire the trigger. If you're using an extension to add PHP to the article, then yes it's doable. The below for example would fire a custom trigger.

Code:
global $_PLUGINS; $_PLUGINS->loadPluginGroup( 'user' ); $_PLUGINS->trigger( 'thisIsMyTrigger', array() );

The above assumes CB API has been loaded. If not then please see the below tutorial on how to do this.

www.joomlapolis.com/support/tutorials/120-api-usage/18357-including-cb-api-for-usage-outside-of-cb


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

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

  • dotcom22
  • dotcom22
  • OFFLINE
  • Posts: 522
  • Thanks: 14
  • Karma: 4
10 years 6 months ago #243814 by dotcom22
Replied by dotcom22 on topic Apply a trigger to submit button
yes I can insert PHP with Sourcerer which is a nice tool.

If I put code inside CB Content module, CB API is already loaded in that case ?

Could you please give me an example of code with a simple link who fire the custom trigger when clicked? My PHP knowledges are very poor :blush:

I use Joomla 3.3.6 - CB 2.0.4 - CBSubs 4 - Several Incubator plugins

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48478
  • Thanks: 8282
  • Karma: 1443
10 years 6 months ago - 10 years 6 months ago #243824 by krileon
Replied by krileon on topic Apply a trigger to submit button

If I put code inside CB Content module, CB API is already loaded in that case ?

Yes.

Could you please give me an example of code with a simple link who fire the custom trigger when clicked? My PHP knowledges are very poor

Doing that when a button is clicked requires a form post or a get request to an endpoint that handles the PHP and firing of the trigger. My example in my previous reply just fires the trigger on render. For what you're wanting you'll need an endpoint inside of Joomla (extension, etc..) that can handle the processing of the button submit.

I suppose what you can do is have the button inside of a form that posts to the page it's already on then in the same code that outputs the form you have an if statement to check for a post value you sent with the form. If that post value exists you'd then fire the trigger.

However, if you can provide why you need this and what you're wanting to do more specifically there maybe a better alternative.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
Last edit: 10 years 6 months ago by krileon.

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

  • dotcom22
  • dotcom22
  • OFFLINE
  • Posts: 522
  • Thanks: 14
  • Karma: 4
10 years 6 months ago #243833 by dotcom22
Replied by dotcom22 on topic Apply a trigger to submit button

However, if you can provide why you need this and what you're wanting to do more specifically there maybe a better alternative.


As I said my goal was to use Auto-Action because it allow to make a bunch of thing without need to be a coder or to build a specific Joomla or CB plugin. The only problem is no action can work without set a CB trigger. I don't see any existent trigger who can help me because they are of course related to CB itself and not to a simple OneClick event. If it was possible to create our own event (could be anything such clicking on specific link, video, image..) and to use a custom trigger which can be used in Auto-Action this could bring many possibility for a bunch of usage such for example send an email when Video1 is watched, fire an external API or update a CB field when Link2 is clicked...

I use Joomla 3.3.6 - CB 2.0.4 - CBSubs 4 - Several Incubator plugins

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48478
  • Thanks: 8282
  • Karma: 1443
10 years 6 months ago #243836 by krileon
Replied by krileon on topic Apply a trigger to submit button
You can use the internalGeneral or internalUsers triggers then have a href link to either/or of their trigger URLs (see CB Auto Actions > Config > Internal for the URLs).


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

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

Moderators: beatnantkrileon
Powered by Kunena Forum