Форма закза, поле индекс сделать обязательным
В XSL-шаблоне адреса доставки для полей, которые требуют обязательного заполнения, добавляется в блок:
<!-- Добавить этот код: -->
<!-- Проверка формы -->
<SCRIPT type="text/javascript" language="JavaScript">
<xsl:comment>
<xsl:text disable-output-escaping="yes">
<![CDATA[
$(document).ready(function()
{
$("#address").validate({
rules: {
site_users_surname: {
required: true,
minlength: 2
},
site_users_name: {
required: true,
minlength: 2
},
site_users_email: {
required: true,
email: true
},
index: {
required: true,
minlength: 6
}
},
messages: {
site_users_surname: "Введите, пожалуйста, фамилию.",
site_users_name: "Введите, пожалуйста, имя.",
site_users_email: "Введите, пожалуйста, корректный e-mail.",
index: "Введите, пожалуйста, индекс.",
},
focusInvalid: true,
errorClass: "input_error"
})
});
]]>
</xsl:text>
</xsl:comment>
</SCRIPT>
<!-- / Конец добавления -->
<form name="address" id="address" method="POST">
<!-- Проверка формы -->
<SCRIPT type="text/javascript" language="JavaScript">
<xsl:comment>
<xsl:text disable-output-escaping="yes">
<![CDATA[
$(document).ready(function()
{
$("#address").validate({
rules: {
site_users_surname: {
required: true,
minlength: 2
},
site_users_name: {
required: true,
minlength: 2
},
site_users_email: {
required: true,
email: true
},
index: {
required: true,
minlength: 6
}
},
messages: {
site_users_surname: "Введите, пожалуйста, фамилию.",
site_users_name: "Введите, пожалуйста, имя.",
site_users_email: "Введите, пожалуйста, корректный e-mail.",
index: "Введите, пожалуйста, индекс.",
},
focusInvalid: true,
errorClass: "input_error"
})
});
]]>
</xsl:text>
</xsl:comment>
</SCRIPT>
<!-- / Конец добавления -->
<form name="address" id="address" method="POST">
МагазинАдресДоставки
что-то я не вижу такого блока в шаблоне в который добавить выделенное полужирным в предыдущем сообщении, шаблон стандартный, не менялся вообще.
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output xmlns="http://www.w3.org/TR/xhtml1/strict" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" encoding="utf-8" indent="yes" method="html" omit-xml-declaration="no" version="1.0" media-type="text/xml"/>
<xsl:template match="/locations">
<!-- Строка шага заказа -->
<ul class="shop_navigation gray">
<li class="shop_navigation_current"><span>Адрес доставки</span>→</li>
<li><span>Способ доставки</span>→</li>
<li><span>Форма оплаты</span>→</li>
<li><span>Данные доставки</span></li>
</ul>
<SCRIPT type="text/javascript" language="JavaScript">
<xsl:comment>
<xsl:text disable-output-escaping="yes">
<![CDATA[
location_select_id = "location";
city_select_id = "sel_city";
cityarea_select_id = "sel_city_area";
]]>
</xsl:text>
</xsl:comment>
</SCRIPT>
<form name="address" id="address" method="POST">
<h1>Адрес доставки</h1>
<p>
<a href="{shop/path}cart/">Корзина</a>
</p>
<table>
<tr>
<td>Страна:</td>
<td>
<select id="country" style="width: 390px;" name="country" onchange="doSetLocation(this.options[this.selectedIndex].value, '{/locations/shop/path}cart/')">
<option value="0">..</option>
<xsl:apply-templates select="country"/>
</select>
<span class="red_star" style="position: relative; top: 4px;"> *</span>
</td>
</tr>
<tr>
<td>Область:</td>
<td>
<xsl:variable name="country_id" select="/locations//country[@select = 1]/@id" />
<select name="location" style="width: 390px;" id="location" onchange="doSetCity(this.options[this.selectedIndex].value, '{/locations/shop/path}cart/')">
<option value="0">..</option>
<xsl:apply-templates select="location[@parent = $country_id]"/>
</select>
<span class="red_star" style="position: relative; top: 4px;"> *</span>
</td>
</tr>
<tr>
<td>Город:</td>
<td>
<select name="sel_city" style="width: 390px;" id="sel_city" onchange="doSetCityArea(this.options[this.selectedIndex].value, '{/locations/shop/path}cart/')">
<option value="0">..</option>
<xsl:apply-templates select="city[@parent = location[@parent = $country_id]]"/>
</select>
</td>
</tr>
<tr>
<td>Район города:</td>
<td>
<select name="sel_city_area" style="width: 390px;" id="sel_city_area">
<option value="0">..</option>
</select>
</td>
</tr>
<tr>
<td style="vertical-align: middle;">Индекс:</td>
<td>
<input type="text" size="5" class="large_input" style="width: 90px;" name="index" value="{external_propertys/site_users_postcode}"/>
</td>
</tr>
<tr>
<td style="vertical-align: middle;">Улица, дом, квартира:<br/>
(город, район, если не выбраны)</td>
<td>
<input type="text" size="30" class="large_input" style="width: 390px;" name="full_address" value="{external_propertys/site_users_address}"/>
</td>
</tr>
<tr>
<td style="vertical-align: middle;">Фамилия, Имя, Отчество:</td>
<td>
<input type="text" size="30" class="large_input" style="width: 124px; margin-right: 5px;" name="site_users_surname" value="{external_propertys/site_users_surname}"/>
<input type="text" size="30" class="large_input" style="width: 124px; margin-right: 5px;" name="site_users_name" value="{external_propertys/site_users_name}"/>
<input type="text" size="30" class="large_input" style="width: 124px; margin-right: 5px;" name="site_users_patronymic" value="{external_propertys/site_users_patronymic}"/>
</td>
</tr>
<tr>
<td style="vertical-align: middle;">Компания:</td>
<td>
<input type="text" size="30" class="large_input" style="width: 390px;" name="site_users_company" value="{external_propertys/site_users_company}"/>
</td>
</tr>
<tr>
<td style="vertical-align: middle;">Телефон:</td>
<td>
<input type="text" size="30" class="large_input" style="width: 390px;" name="site_users_phone" value="{external_propertys/site_users_phone}"/>
</td>
</tr>
<tr>
<td style="vertical-align: middle;">Факс:</td>
<td>
<input type="text" size="30" class="large_input" style="width: 390px;" name="site_users_fax" value="{external_propertys/site_users_fax}"/>
</td>
</tr>
<tr>
<td style="vertical-align: middle;">E-mail:</td>
<td>
<input type="text" size="30" class="large_input" style="width: 390px;" name="site_users_email" value="{external_propertys/site_users_email}"/>
</td>
</tr>
<tr>
<td style="vertical-align: middle;" >Комментарий к заказу:</td>
<td>
<textarea rows="2" class="large_input" style="width: 390px;" name="description"></textarea>
</td>
</tr>
<tr>
<td>
<div class="gray_button">
<div>
<input name="step_2" value="Далее →" type="submit"></input>
</div>
</div>
</td>
</tr>
</table>
</form>
<!-- Заполняем все дочерние элементы страны -->
<SCRIPT type="text/javascript" language="JavaScript">
var oldHandler=window['onload'];
window['onload']=function(){if(typeof(oldHandler)=='function'){oldHandler();}newHandler();};
function newHandler(){
doSetLocation(document.getElementById('country').options[document.getElementById('country').selectedIndex].value, '<xsl:value-of select="/locations/shop/path" />cart/');
}
</SCRIPT>
</xsl:template>
<!-- Шаблон заполняет options для стран -->
<xsl:template match="country">
<xsl:choose>
<!-- Если страна задана по умолчанию -->
<xsl:when test="@select=1">
<option value="{@id}" selected="selected" style="font-weight: bold;">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</option>
</xsl:when>
<xsl:otherwise>
<option value="{@id}">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</option>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Шаблон заполняет options для местоположений (областей) -->
<xsl:template match="location">
<option value="{@id}">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</option>
</xsl:template>
<!-- Шаблон заполняет options для городов -->
<!--<xsl:template match="city">
<option value="{@id}">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</option>
</xsl:template>-->
<xsl:template match="city">
<xsl:choose>
<!-- Если страна задана по умолчанию -->
<xsl:when test="@id=2391">
<option value="{@id}" selected="selected" style="font-weight: bold;">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</option>
</xsl:when>
<xsl:otherwise>
<option value="{@id}">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</option>
</xsl:otherwise>
</xsl:choose> </xsl:template>
<!-- Шаблон заполняет options для районов -->
<xsl:template match="cityarea">
<option value="{@id}">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</option>
</xsl:template>
</xsl:stylesheet>
<!DOCTYPE xsl:stylesheet>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output xmlns="http://www.w3.org/TR/xhtml1/strict" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" encoding="utf-8" indent="yes" method="html" omit-xml-declaration="no" version="1.0" media-type="text/xml"/>
<xsl:template match="/locations">
<!-- Строка шага заказа -->
<ul class="shop_navigation gray">
<li class="shop_navigation_current"><span>Адрес доставки</span>→</li>
<li><span>Способ доставки</span>→</li>
<li><span>Форма оплаты</span>→</li>
<li><span>Данные доставки</span></li>
</ul>
<SCRIPT type="text/javascript" language="JavaScript">
<xsl:comment>
<xsl:text disable-output-escaping="yes">
<![CDATA[
location_select_id = "location";
city_select_id = "sel_city";
cityarea_select_id = "sel_city_area";
]]>
</xsl:text>
</xsl:comment>
</SCRIPT>
<form name="address" id="address" method="POST">
<h1>Адрес доставки</h1>
<p>
<a href="{shop/path}cart/">Корзина</a>
</p>
<table>
<tr>
<td>Страна:</td>
<td>
<select id="country" style="width: 390px;" name="country" onchange="doSetLocation(this.options[this.selectedIndex].value, '{/locations/shop/path}cart/')">
<option value="0">..</option>
<xsl:apply-templates select="country"/>
</select>
<span class="red_star" style="position: relative; top: 4px;"> *</span>
</td>
</tr>
<tr>
<td>Область:</td>
<td>
<xsl:variable name="country_id" select="/locations//country[@select = 1]/@id" />
<select name="location" style="width: 390px;" id="location" onchange="doSetCity(this.options[this.selectedIndex].value, '{/locations/shop/path}cart/')">
<option value="0">..</option>
<xsl:apply-templates select="location[@parent = $country_id]"/>
</select>
<span class="red_star" style="position: relative; top: 4px;"> *</span>
</td>
</tr>
<tr>
<td>Город:</td>
<td>
<select name="sel_city" style="width: 390px;" id="sel_city" onchange="doSetCityArea(this.options[this.selectedIndex].value, '{/locations/shop/path}cart/')">
<option value="0">..</option>
<xsl:apply-templates select="city[@parent = location[@parent = $country_id]]"/>
</select>
</td>
</tr>
<tr>
<td>Район города:</td>
<td>
<select name="sel_city_area" style="width: 390px;" id="sel_city_area">
<option value="0">..</option>
</select>
</td>
</tr>
<tr>
<td style="vertical-align: middle;">Индекс:</td>
<td>
<input type="text" size="5" class="large_input" style="width: 90px;" name="index" value="{external_propertys/site_users_postcode}"/>
</td>
</tr>
<tr>
<td style="vertical-align: middle;">Улица, дом, квартира:<br/>
(город, район, если не выбраны)</td>
<td>
<input type="text" size="30" class="large_input" style="width: 390px;" name="full_address" value="{external_propertys/site_users_address}"/>
</td>
</tr>
<tr>
<td style="vertical-align: middle;">Фамилия, Имя, Отчество:</td>
<td>
<input type="text" size="30" class="large_input" style="width: 124px; margin-right: 5px;" name="site_users_surname" value="{external_propertys/site_users_surname}"/>
<input type="text" size="30" class="large_input" style="width: 124px; margin-right: 5px;" name="site_users_name" value="{external_propertys/site_users_name}"/>
<input type="text" size="30" class="large_input" style="width: 124px; margin-right: 5px;" name="site_users_patronymic" value="{external_propertys/site_users_patronymic}"/>
</td>
</tr>
<tr>
<td style="vertical-align: middle;">Компания:</td>
<td>
<input type="text" size="30" class="large_input" style="width: 390px;" name="site_users_company" value="{external_propertys/site_users_company}"/>
</td>
</tr>
<tr>
<td style="vertical-align: middle;">Телефон:</td>
<td>
<input type="text" size="30" class="large_input" style="width: 390px;" name="site_users_phone" value="{external_propertys/site_users_phone}"/>
</td>
</tr>
<tr>
<td style="vertical-align: middle;">Факс:</td>
<td>
<input type="text" size="30" class="large_input" style="width: 390px;" name="site_users_fax" value="{external_propertys/site_users_fax}"/>
</td>
</tr>
<tr>
<td style="vertical-align: middle;">E-mail:</td>
<td>
<input type="text" size="30" class="large_input" style="width: 390px;" name="site_users_email" value="{external_propertys/site_users_email}"/>
</td>
</tr>
<tr>
<td style="vertical-align: middle;" >Комментарий к заказу:</td>
<td>
<textarea rows="2" class="large_input" style="width: 390px;" name="description"></textarea>
</td>
</tr>
<tr>
<td>
<div class="gray_button">
<div>
<input name="step_2" value="Далее →" type="submit"></input>
</div>
</div>
</td>
</tr>
</table>
</form>
<!-- Заполняем все дочерние элементы страны -->
<SCRIPT type="text/javascript" language="JavaScript">
var oldHandler=window['onload'];
window['onload']=function(){if(typeof(oldHandler)=='function'){oldHandler();}newHandler();};
function newHandler(){
doSetLocation(document.getElementById('country').options[document.getElementById('country').selectedIndex].value, '<xsl:value-of select="/locations/shop/path" />cart/');
}
</SCRIPT>
</xsl:template>
<!-- Шаблон заполняет options для стран -->
<xsl:template match="country">
<xsl:choose>
<!-- Если страна задана по умолчанию -->
<xsl:when test="@select=1">
<option value="{@id}" selected="selected" style="font-weight: bold;">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</option>
</xsl:when>
<xsl:otherwise>
<option value="{@id}">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</option>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Шаблон заполняет options для местоположений (областей) -->
<xsl:template match="location">
<option value="{@id}">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</option>
</xsl:template>
<!-- Шаблон заполняет options для городов -->
<!--<xsl:template match="city">
<option value="{@id}">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</option>
</xsl:template>-->
<xsl:template match="city">
<xsl:choose>
<!-- Если страна задана по умолчанию -->
<xsl:when test="@id=2391">
<option value="{@id}" selected="selected" style="font-weight: bold;">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</option>
</xsl:when>
<xsl:otherwise>
<option value="{@id}">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</option>
</xsl:otherwise>
</xsl:choose> </xsl:template>
<!-- Шаблон заполняет options для районов -->
<xsl:template match="cityarea">
<option value="{@id}">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</option>
</xsl:template>
</xsl:stylesheet>
что-то я не вижу такого блока в шаблоне в который добавить выделенное полужирным в предыдущем сообщении, шаблон стандартный, не менялся вообще.
Жизнь не преодоление сложностей, а поиск возможностей © DSergeev
Авторизация