Hi all,
I am trying to create a script in Campaign that will let me switch from one div id to another based on the language the recipient picked. The languages are English or French. I have a script I create below but now my page is blank.
<script>
var query = xtk.queryDef.create(
<queryDef schema="nms:recipient" operation="getIfExists">
<select>
<node expr="@language"/>
</select>
</queryDef>
var language=@language
var english=document.getElementById("engThanks")
var french=document.getElementById("frThanks")
if(language == ENG){
english.style.display = "block";
}else ){
english.style.display = "none";
french.style.display = "block";
}
</script>
Solved! Go to Solution.
Views
Replies
Total Likes
Hello,
Please check following points.
Go to Platform -> Enumeration.
2. If you want to check only for one recipient then you need to give some condition in the queryDef. In the below example I added Id.
var query = xtk.queryDef.create(
<queryDef schema="nms:recipient" operation="getIfExists">
<select>
<node expr="@language"/>
</select>
<where>
<condition expr="@id = 1" />
</where>
</queryDef>
// Run the query.
var res = query.ExecuteQuery();
if ( res.@language =='E' )
{
// Add code to show english div
}
else {
// Add the code to show French div
}
Thanks.
Parvesh.
Hello,
Please check following points.
Go to Platform -> Enumeration.
2. If you want to check only for one recipient then you need to give some condition in the queryDef. In the below example I added Id.
var query = xtk.queryDef.create(
<queryDef schema="nms:recipient" operation="getIfExists">
<select>
<node expr="@language"/>
</select>
<where>
<condition expr="@id = 1" />
</where>
</queryDef>
// Run the query.
var res = query.ExecuteQuery();
if ( res.@language =='E' )
{
// Add code to show english div
}
else {
// Add the code to show French div
}
Thanks.
Parvesh.
Hi @StrawHatM23,
Was the given solution helpful to resolve your query or do you still need more help here? Do let us know.
Thanks!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies