Preloading in Webapp with Custom schema
Hi,
I'm trying to preload a checkbox on my Webpps form.(i'm using the HTML page variant) This is the method i'm using of trying to preload it.
<input id="checkbox1" type="checkbox" <%=if(ctx.vars.commercial == '1'){%> checked="checked" <%}%> /> <label for="checkbox1"></label>
But as soon as i save and publish the code changes to this:
<input id="checkbox1" type="checkbox" checked="checked" gt="" 1="" commercial="=" vars="" ctx="" if="" lt="" /> <label for="checkbox1"></label>
Am i doing something wrong? How should i preload the checkbox?
I'm using the following javascript to prefill the ctx variables:
var query = xtk.queryDef.create(
<queryDef schema="cus:CustomerOptins" operation="select">
<select>
<node expr="@Information"/>
<node expr="@Commercial"/>
<node expr="@Email"/>
</select>
<where>
<condition expr={"@Customer_key ='"+ctx.recipient.Cus_Key+"'"}/>
</where>
</queryDef>
)
var queryResult = query.ExecuteQuery();
for each(var service in queryResult) {
var information = service.@Information
var commcercial = service.@Commercial
var email = service.@Email
}
ctx.vars.commercial = commcercial
ctx.vars.information = information
ctx.vars.email = email
Hope somebody can help me 🙂


