From 0b358a07a87a76330d4afb7c0d8aefee96dfa5ec Mon Sep 17 00:00:00 2001 From: Vikas Mayur Date: Tue, 16 Sep 2008 09:29:14 +0000 Subject: [PATCH] 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 --- .../ecommerce/customer/profile/NewCustomer.ftl | 6 ++++-- .../ecommerce/webapp/ecommerce/images/profile.js | 12 ++++++++++++ applications/ecommerce/widget/CustomerScreens.xml | 1 + 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/applications/ecommerce/webapp/ecommerce/customer/profile/NewCustomer.ftl b/applications/ecommerce/webapp/ecommerce/customer/profile/NewCustomer.ftl index bca6097a63..60e571f2b3 100644 --- a/applications/ecommerce/webapp/ecommerce/customer/profile/NewCustomer.ftl +++ b/applications/ecommerce/webapp/ecommerce/customer/profile/NewCustomer.ftl @@ -56,11 +56,13 @@ under the License.
-
+
+
-
+
+
diff --git a/applications/ecommerce/webapp/ecommerce/images/profile.js b/applications/ecommerce/webapp/ecommerce/images/profile.js index 6b3db3abda..6b90cc5c4e 100644 --- a/applications/ecommerce/webapp/ecommerce/images/profile.js +++ b/applications/ecommerce/webapp/ecommerce/images/profile.js @@ -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' + }); } \ No newline at end of file diff --git a/applications/ecommerce/widget/CustomerScreens.xml b/applications/ecommerce/widget/CustomerScreens.xml index 118c9e585e..af02affced 100644 --- a/applications/ecommerce/widget/CustomerScreens.xml +++ b/applications/ecommerce/widget/CustomerScreens.xml @@ -522,6 +522,7 @@ under the License.
+