Auto Action set a cb field content

4 years 5 months ago #315240 by mikegrimwade
Auto Action set a cb field content was created by mikegrimwade
Forgive what is probably a simple question but how do I set a field value within the action tab for a code type Auto Action?

Something like ...

[cb_profile_title] = $_GET["param1"];

Please Log in to join the conversation.

4 years 5 months ago #315244 by krileon
Replied by krileon on topic Auto Action set a cb field content
Ensure you've a Field auto action type selected. Then under Action the below should work fine.

Field: cb_profile_title
Operator: Set
Value: [get_param1]

Note you should apply filtering when grabbing raw values like that though. The below for example would filter the value to a string.

Action
Field: cb_profile_title
Operator: Set
Value: [cb:parse function="clean" method="string"][get_param1][/cb:parse]
Parameters
Format Functions: Yes


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.
The following user(s) said Thank You: mikegrimwade

Please Log in to join the conversation.

4 years 5 months ago #315251 by mikegrimwade
Replied by mikegrimwade on topic Auto Action set a cb field content
Ok so I've switched to a Field Auto Action.

The action is manually triggered using the below URL.

index.php?option=com_comprofiler&view=pluginclass&plugin=cbautoactions&action=action&actions=97&Itemid=181&fav=350

Plan was to pick up that "fav" query string value and set the field. So following your advice (simple first, input validated after) I've set...

Field: cb_profile_title
Operator: Set
Value: [get_fav]

However when I trigger the action the cb_profile_title becomes "[get_fav]" rather than "350".

I'm also echoing out under the out tab and [get_fav] is showing 350 on the output. I must be missing something??

Substitutions is on.

Please Log in to join the conversation.

4 years 5 months ago #315252 by mikegrimwade
Replied by mikegrimwade on topic Auto Action set a cb field content
Nope never mind. It's suddenly started working.

Please Log in to join the conversation.

4 years 5 months ago #315259 by krileon
Replied by krileon on topic Auto Action set a cb field content
What trigger are you using? It shouldn't have any issues grabbing GET values. Please be sure you add filtering to it. You're storing raw user input, which is dangerous. Since it's an integer you can use the below to be sure it's filter to integer at all times.

Action
Field: cb_profile_title
Operator: Set
Value: [cb:parse function="clean" method="int"][get_fav][/cb:parse]
Parameters
Format Functions: Yes


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.
The following user(s) said Thank You: mikegrimwade

Please Log in to join the conversation.

4 years 5 months ago #315356 by mikegrimwade
Replied by mikegrimwade on topic Auto Action set a cb field content
I'm triggering the action directly when user clicks on a link. I'm not handling any of the predefined events.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.260 seconds

Facebook Twitter LinkedIn