I am trying to write code in which multiple searches and iframes work together to achieve specified results. I am building this site in business catalyst, so it uses WebApps.
Currently I am trying to submit a search into an iframe and then return a dynamic value to the parent window via form fields. I have been receiving the Uncaught SyntaxError: Unexpected identifier error in response to my code. If anyone could help me by taking a look at my code I would be very appreciative. Thank you!
NOTE: The {module_webappresults} tag is part of business catalyst. When this is rendered on the page a series of divs with values is output to the DOM, several of these items will change the value of the variables.
var chapNum = null;
var chapter1ID = 0;
var chapter2ID = 0;
var chapter3ID = 0;
var chapter4ID = 0;
var chapter5ID = 0;
var chapter1 = false;
var chapter2 = false;
var chapter3 = false;
var chapter4 = false;
var chapter5 = false;
</script>
<div id="results">{module_webappsresults,,_self,true,-1,,1}</div>
<form name="chapter-ids" id="chapter-ids" action="" method="post">
<input type="text" maxlength="255" name="chap-id-1" id="chap-id-1" class="cat_textbox" value=""/>
<input type="text" maxlength="255" name="chap-id-2" id="chap-id-2" class="cat_textbox" value=""/>
<input type="text" maxlength="255" name="chap-id-3" id="chap-id-3" class="cat_textbox" value=""/>
<input type="text" maxlength="255" name="chap-id-4" id="chap-id-4" class="cat_textbox" value=""/>
<input type="text" maxlength="255" name="chap-id-5" id="chap-id-5" class="cat_textbox" value=""/>
<input type="text" maxlength="255" name="total-chapters" id="total-chapters" class="cat_textbox" value=""/>
</form>
<script>
for (var i = 0; i <= chapNum; i++) {
var formID = chap-id-[i];
document.getElementById(formID).value = chapter[i]ID;
parent.chapterData(this.form.formID.value)
};
document.getElementById('total-chapters').value = chapNum;
parent.totalChapters(this.form.total-chapters.value)
document.write(chapNum);