2022.2

Table Of Contents
Thefollowingscriptclonesandpopulatesaboilerplaterow.Oncecompletedyouwillneedtohidethe
boilerplaterow.
for(var i = 0; i < record.tables['detail'].length; i++) {
var row = results.clone(); //Clone our boilerplate row
row.find('@ItemNumber@').text( record.tables['detail'][i].fields["ItemNumber"]);
row.find('@ItemOrdered@').text( record.tables['detail'][i].fields["ItemOrdered"]);
row.find('@ItemTotal@').text( record.tables['detail'][i].fields["ItemTotal"]);
row.find('@ItemDesc@').text( record.tables['detail'][i].fields["ItemDesc"]);
row.find('@nr@').text( i );
results.parent().append(row);
}
// Hide our boilerplate row (note that this doesn't really delete the row).
results.hide();
html()
InaControlScript,thehtml()functionofasectionorMasterPagecanbeusedtogettheinitialcon-
tentsofits<body>,andmodifythem.Thismakesitpossible,forexample,topopulateasectionor
MasterPagewithelementsretrievedfromaContentManagementsystem,beforeStandardScripts
run.
html()
Getstheinitialcontentsofthe<body>ofasectionorMasterPage.
html(value)
Replacesthecontentsofthe<body>ofasectionorMasterPagewiththesuppliedvalue.Thisfunction
isonlyavailableinControlScripts.Seealso:"section"onpage1305and"masterpage"onpage1274.
value
AStringthatmaycontainHTMLtags.
Examples
Thefollowingscriptuseshtml()toretrievethecontentsofasectionandaddaparagraphtoit.
var foo = merge.context.sections["Section 1"].html();
foo += "<p>hello world</p>";
merge.context.sections["Section 1"].html( foo );
Thefollowingscriptloadsasnippetbasedonthevalueofafield,andthenreplacesthecontentofa
Printsectionwiththesnippetusinghtml().
var mySection = merge.context.sections["Section 1"];
var promoTxt = loadhtml('snippets/promo-' + record.fields['City'] + '.html');
mySection.html(promoTxt);
Page 1291