无法在SFCC需求软件中保存用户选择的选择列表值



我在标准的"profile"对象中创建了一个新属性(preferenteStore-String数据类型的枚举(,并将其添加到storefront中的帐户创建页面。现在,我无法将用户选择的picklist值从ISML获取到js。我尝试了下面的代码,但它返回了undefined。你能帮我做这个吗。

以下是isml代码:registerForm.isml

<div class="form-group
<isif condition=" ${!!pdict.profileForm.customer.favouriteStore.mandatory === true}">required</isif>">
<label class="form-control-label" for="registration-form-favouriteStore">
<isprint value="${pdict.profileForm.customer.favouriteStore.label}" encoding="htmlcontent" />
</label>
<div class="info-icon">
<span><i class="fa fa-info-circle beet-color" aria-hidden="true"></i></span>
<span class="tooltip account-tooltip d-none">Pick your favourite store</span>
</div>
<select class="custom-select form-control" id="favouriteStore" onchange="getSelected(this)" name="favouriteStore">
<isloop items=${pdict.profileForm.customer.favouriteStore.options} var="store">
<option id="${store.id}" value="${store.htmlValue}" 
<isif condition="${store.selected}">selected</isif> >${store.label}</option>
</isloop>
</select>
</div>

Js代码:Account.Js

var registrationFormObj = {
firstName: registrationForm.customer.firstname.value,
lastName: registrationForm.customer.lastname.value,
phone: registrationForm.customer.phone.value,
email: registrationForm.customer.email.value,
emailConfirm: registrationForm.customer.emailconfirm.value,
password: registrationForm.login.password.value,
passwordConfirm: registrationForm.login.passwordconfirm.value,
customerPostcode: registrationForm.customer.customerPostcode.value,
favouriteStore: registrationForm.customer.favouriteStore.value,
marketingPreferences: registrationForm.customer.marketingPreferences.value,
validForm: registrationForm.valid,
form: registrationForm
};

profile.xml:

<field formid="favouriteStore" label="Favourite Store" type="string" mandatory="true" binding="favouriteStore">
<options>
<option optionid="" label="" value=""/>
<option optionid="1" label="Shell Kingsburn, Borough of Royal Kensington, London EC2 3AH" value="Shell Kingsburn Borough of Royal Kensington, London EC2 3AH"/>
<option optionid="2" label="Chealsea, City Road, London EC2 9AW" value="Chealsea, City Road, London EC2 9AW"/>
<option optionid="3" label="London Store, 2nd Street, London  EC2 9AW" value="London Store, 2nd Street, London  EC2 9AW"/>
</options>
</field>

所有其他字符串字段都被保存,只有这个preferenteStore picklist字段返回未定义。你能告诉我这个哪里不对吗。

提前感谢!

正如AlBlue所提到的,问题似乎是您在ISML和DWScript中没有以相同的方式拼写favouriteStore。(JavaScript(

也就是说,您应该确保还为该字段定义了表单XML。例如,您应该将其添加到店面盒带的cartridge/forms/default/profile.xml文件中。(或覆盖app_storefront_base中的一个(

相关内容

  • 没有找到相关文章

最新更新