X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Javascript in odd places (fails validation) (https://forum.x-cart.com/showthread.php?t=18096)

Mr Bob 11-20-2005 01:10 AM

Javascript in odd places (fails validation)
 
Good ole document type does not allow element "script" here

There is an issue with the place that the javascript is being placed. Issue is in both the check_options.tpl and the customer_options.tpl file.

How do you get around this failed validation?

The customer_options.tpl file:

Code:

{* $Id: customer_options.tpl,v 1.16.2.4 2005/03/02 06:16:56 max Exp $ *}
{if $product_options ne ''}
<script type="text/javascript" language="JavaScript 1.2">
var alert_msg = '{$alert_msg}';
</script>
{include file="modules/Product_Options/check_options.tpl"}

{foreach from=$product_options item=v}
{if $v.options ne '' || $v.is_modifier eq 'T'}
<tr>
<td valign="middle" height="25">{if $usertype eq "A"}{$v.class}{else}{$v.classtext|default:$v.class}{/if}</td>
<td valign="middle">
{if $cname ne ""}
{assign var="poname" value="$cname[`$v.classid`]"}
{else}
{assign var="poname" value="product_options[`$v.classid`]"}
{/if}
{if $v.is_modifier eq 'T'}
<input id="po{$v.classid}" type="text" name="{$poname}" value="{$v.default|escape}">
{else}
<select id="po{$v.classid}" name="{$poname}"{if $disable} disabled{/if} onchange="javascript: check_options();">
{foreach from=$v.options item=o}
<option value="{$o.optionid}"{if $o.selected eq 'Y'} selected{/if}>{$o.option_name}{if $v.is_modifier eq 'Y' && $o.price_modifier ne 0} {/if}</option>
{/foreach}
</select>
{/if}
</td>
</tr>
{/if}
{/foreach}
{/if}


{if $product_options_ex ne ""}
<tr>
    <td colspan="2"><font id="exception_msg" color="red">{if $err ne ''}{/if}</font></td>
</tr>
{if $err ne ''}
<tr>
        <td colspan="2"><FONT class="CustomerMessage">{$lng.txt_product_options_combinations_warn}:</FONT></td>
</tr>
{foreach from=$product_options_ex item=v}
<tr>
        <td>{foreach from=$v item=o}{if $usertype eq "A"}{$o.class}{else}{$o.classtext}{/if}: {$o.option_name}
{/foreach}
</td>
</tr>
{/foreach}
{/if}
{/if}


Zaja 11-20-2005 01:58 AM

Javascript tags must go outside the table tags or inside the td tags to validate...nothing follows the table tag except tr or th......and use CDATA for check_options.tpl.
Code:

<script type="text/javascript">
  //<![CDATA[
  {include file="modules/Product_Options/check_options.tpl"}
    //]]> 
  </script>



All times are GMT -8. The time now is 02:03 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.