Client side validation on Account Information section of new customer page. Contribution from Rishi Solanki.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@695785 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Vikas Mayur
2008-09-16 09:29:14 +00:00
parent b44bc3b1e2
commit 0b358a07a8
3 changed files with 17 additions and 2 deletions
@@ -56,11 +56,13 @@ under the License.
</div>
<div class="form-row">
<div class="field-label"><label for="password">${uiLabelMap.CommonPassword}* <span id="advice-required-password" style="display: none" class="errorMessage">(required)</span></label></div>
<div><input type="password" name="password" id="password" class="required" value="${parameters.password?if_exists}" maxlength="16"></div>
<div><input type="password" name="password" id="password" class="required validate-password" value="${parameters.password?if_exists}" maxlength="16"></div>
<span id="advice-validate-password-password" class="errorMessage" style="display:none">${uiLabelMap["loginservices.password_may_not_equal_username"]}</span>
</div>
<div class="form-row">
<div class="field-label"><label for="passwordVerify">${uiLabelMap.PartyRepeatPassword}* <span id="advice-required-passwordVerify" style="display: none" class="errorMessage">(required)</span></label></div>
<div><input type="password" name="passwordVerify" id="passwordVerify" class="required" value="${parameters.passwordVerify?if_exists}" maxlength="16"></div>
<div><input type="password" name="passwordVerify" id="passwordVerify" class="required validate-passwordVerify" value="${parameters.passwordVerify?if_exists}" maxlength="16"></div>
<span id="advice-validate-passwordVerify-passwordVerify" class="errorMessage" style="display:none">${uiLabelMap["loginservices.password_did_not_match_verify_password"]}</span>
</div>
</div>
</div>
@@ -4,6 +4,7 @@ var validatePostalAddress = null;
Event.observe(window, 'load', function() {
if ($('newUserForm')) {
validateNewUser = new Validation('newUserForm', {immediate: true, onSubmit: false});
addValidations();
Event.observe($('emailAddress'), 'change', setUserNameFromEmail);
Event.observe('useShippingAddressForBilling', 'click', useShippingAddressAsBillingToggle);
Event.observe($('submitNewUserForm'), 'click', submitValidNewUser);
@@ -336,4 +337,15 @@ function stopObservingShipToBillAddress() {
Event.stopObserving($('shipToStateProvinceGeoId'), 'change', "");
Event.stopObserving($('shipToCountryGeoId'), 'change', "");
Event.stopObserving($('shipToPostalCode'), 'change', "");
}
function addValidations() {
Validation.add('validate-password', "", {
minLength : 5,
notOneOf : ['password','PASSWORD'],
notEqualToField : 'username'
});
Validation.add('validate-passwordVerify', "", {
equalToField : 'password'
});
}
@@ -522,6 +522,7 @@ under the License.
<section>
<actions>
<property-map resource="MarketingUiLabels" map-name="uiLabelMap" global="true"/>
<property-map resource="SecurityextUiLabels" map-name="uiLabelMap" global="true"/>
<set field="titleProperty" value="PageTitleNewCustomer"/>
<set field="layoutSettings.javaScripts[]" value="/ecommerce/images/profile.js" global="true"/>
</actions>