Hi,
I need to pass a Dreamweaver template variable to some javascript code within the template. The javascript is very straightforward in that it simply sets a form variable to the value held in the template.
The variable is defined as RestrictSearch and the page holds a value of "SCAN" for this instance.
Inside an editable region of the page is a form that comes from an include file.
The template has a region that writes the following javascript from within the template to update this form.
<!-- TemplateBeginIf cond="_document['RestrictSearch']" -->
<script language="javascript">
document.with_restrict.restrict.value='<!-- TemplateExpr expr="RestrictSearch" -->';
</script>
<!-- TemplateEndIf -->
If the page has a value for RestrictSearch (rather than "") the region is written from the template this prevents me getting a script error when the form isn't present.
Ultimately I want to push this javascript code out to an SSI so that it ties with the rest of our template(s) but that's another question.
At present the code works in that it writes the javascript to the page correctly, however the value that is written out is not the value of RestrictSearch (SCAN), rather it's <!-- TemplateExpr expr="RestrictSearch" --> as a string.
Any help would be greatly appreciated.
I need to pass a Dreamweaver template variable to some javascript code within the template. The javascript is very straightforward in that it simply sets a form variable to the value held in the template.
The variable is defined as RestrictSearch and the page holds a value of "SCAN" for this instance.
Inside an editable region of the page is a form that comes from an include file.
The template has a region that writes the following javascript from within the template to update this form.
<!-- TemplateBeginIf cond="_document['RestrictSearch']" -->
<script language="javascript">
document.with_restrict.restrict.value='<!-- TemplateExpr expr="RestrictSearch" -->';
</script>
<!-- TemplateEndIf -->
If the page has a value for RestrictSearch (rather than "") the region is written from the template this prevents me getting a script error when the form isn't present.
Ultimately I want to push this javascript code out to an SSI so that it ties with the rest of our template(s) but that's another question.
At present the code works in that it writes the javascript to the page correctly, however the value that is written out is not the value of RestrictSearch (SCAN), rather it's <!-- TemplateExpr expr="RestrictSearch" --> as a string.
Any help would be greatly appreciated.