This conversation has been locked due to inactivity. Please create a new post.
This conversation has been locked due to inactivity. Please create a new post.
Hi, I tried using the below custom code to capture dropdown selection values as data element. It works in console but when i input the code as a data element and check the _satellite.getVar() for this data element, it just returns an empty value "".
My Javascript is basic and i am fairly new to Adobe Launch so step by step instructions with visuals would be great.
Thank you
var selectElm = document.querySelector("#order_retailer_name")
selectElm.addEventListener("click",function(){
var elm = this;
var selectedElm = elm.options[elm.selectedIndex].textContent;
return selectElm;
});
Solved! Go to Solution.
Views
Replies
Total Likes
That code will not work in Data Element custom code as it's asynchronous.
One of the options is as follows:
That code will not work in Data Element custom code as it's asynchronous.
One of the options is as follows:
Hi @Andrey_Osadchuk thank you very much for your reply, much appreciated. I have a couple of further questions in regards to this which i hope you can help me with. I am trying to capture the successful submission of when user selects a retailer, inputs a voucher code and clicks Apply code. This then takes the user to a new page!
Visual below;
From your previous solution, i am thinking to create two rules for "Select retailer" and "voucher code" input following the method you proposed. Then i will create a third rule which will capture the Apply code click but with a condition of only firing the rule if the next page loads using page path. Under actions, i was thinking to use two eVars which will use the data elements that will be created in the first two rules and an event. See example below;
I tried using this approach and the rules fire but it says the conditions have not been met (this happens for all 3 rules).
Any guidance would be much appreciated.
Thanks,
Kamil
Views
Replies
Total Likes
Kamil,
You should add "return true;" at the end of the custom code to meet the condition criteria.
For the use case you have described, I would consider creating a single rule that gets fired on the button click. At that moment it should be possible to pull the values from both inputs using a custom JS code. In other words, if you are confident in JS and do not need to capture the input fields values unless the visitor submits the form, consider a single rule.
Views
Replies
Total Likes
Views
Likes
Replies