You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Jacques Le Roux <ja...@les7arts.com> on 2010/09/15 21:33:05 UTC

Re: svn commit: r997420 - in /ofbiz/trunk: applications/accounting/webapp/accounting/images/ applications/order/webapp/ordermgr/images/js/ applications/order/webapp/ordermgr/order/ applications/party/webapp/partymgr/js/ specialpurpose/ecommerce/webapp/ecom

Not quite right but still better
http://www.prototypejs.org/api/document/observe

http://www.prototypejs.org/api/event/observe
<<Of course, you'd want this line of code to run once the form exists in the DOM; but putting inline scripts in the document is 
pretty obtrusive, so instead we'll go for a simple approach that waits till the page is fully loaded:

Event.observe(window, 'load', function() {
  Event.observe('signinForm', 'submit', checkForm);
});
Just a little wrapping…

Note that if your page is heavy, you might want to run this code before the page is fully loaded: just wait until the DOM is loaded, 
that will be enough. (Prototype's dom:loaded event can help you with that.)>>

Jacques

From: <do...@apache.org>
> Author: doogie
> Date: Wed Sep 15 17:56:37 2010
> New Revision: 997420
>
> URL: http://svn.apache.org/viewvc?rev=997420&view=rev
> Log:
> Fix incorrect use of window->load event, instead doing
> document->dom:loaded.  In internet explorer, the window->load event can
> happen before the document is actually parsed and converted to DOM nodes.
>
> Modified:
>    ofbiz/trunk/applications/accounting/webapp/accounting/images/costCenters.js
>    ofbiz/trunk/applications/order/webapp/ordermgr/images/js/OrderShippingInfo.js
>    ofbiz/trunk/applications/order/webapp/ordermgr/images/js/geoAutoCompleter.js
>    ofbiz/trunk/applications/order/webapp/ordermgr/images/js/return.js
>    ofbiz/trunk/applications/order/webapp/ordermgr/order/ordershippinginfo.ftl
>    ofbiz/trunk/applications/party/webapp/partymgr/js/PartyProfileContent.js
>    ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/images/checkoutProcess.js
>    ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/images/productAdditionalView.js
>    ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/images/profile.js
>    ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/images/quickAnonCustSettings.js
>    ofbiz/trunk/specialpurpose/webpos/webapp/webpos/images/js/SearchProducts.js
>    ofbiz/trunk/themes/bizznesstime/webapp/bizznesstime/js/application.js
>    ofbiz/trunk/themes/droppingcrumbs/webapp/droppingcrumbs/js/application.js
>    ofbiz/trunk/themes/tomahawk/includes/appbarClose.ftl
>
> Modified: ofbiz/trunk/applications/accounting/webapp/accounting/images/costCenters.js
> URL: 
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/images/costCenters.js?rev=997420&r1=997419&r2=997420&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/accounting/webapp/accounting/images/costCenters.js (original)
> +++ ofbiz/trunk/applications/accounting/webapp/accounting/images/costCenters.js Wed Sep 15 17:56:37 2010
> @@ -17,7 +17,7 @@
>  * under the License.
>  */
>
> -Event.observe(window, 'load', function() {
> +document.observe('dom:loaded', function() {
>     Event.observe($('costCentersSubmit'), 'click', processCostCenterData);
>     // Find all text boxes in form and add a method to list on for on change.
>     var categoryShareInputs = $('costCenters').getInputs('text');
>
> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/images/js/OrderShippingInfo.js
> URL: 
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/images/js/OrderShippingInfo.js?rev=997420&r1=997419&r2=997420&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/order/webapp/ordermgr/images/js/OrderShippingInfo.js (original)
> +++ ofbiz/trunk/applications/order/webapp/ordermgr/images/js/OrderShippingInfo.js Wed Sep 15 17:56:37 2010
> @@ -18,7 +18,7 @@ under the License.
> */
>
> var validateNewShippingAdd = null;
> -Event.observe(window, 'load', function() {
> +document.observe('dom:loaded', function() {
>     if ($('addShippingAddress')) {
>         validateNewShippingAdd = new Validation('addShippingAddress', {immediate: true, onSubmit: false});
>         Event.observe($('countryGeoId'), 'change', function() {
>
> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/images/js/geoAutoCompleter.js
> URL: 
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/images/js/geoAutoCompleter.js?rev=997420&r1=997419&r2=997420&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/order/webapp/ordermgr/images/js/geoAutoCompleter.js (original)
> +++ ofbiz/trunk/applications/order/webapp/ordermgr/images/js/geoAutoCompleter.js Wed Sep 15 17:56:37 2010
> @@ -17,7 +17,7 @@
>  * under the License.
>  */
>
> -Event.observe(window, 'load', function() {
> +document.observe('dom:loaded', function() {
>     // Autocompleter for shipping panel
>     // Preventing getCountryList() from calling and not removed all autocompleter functions so that we can reuse in future.
>     //getCountryList();
>
> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/images/js/return.js
> URL: 
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/images/js/return.js?rev=997420&r1=997419&r2=997420&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/order/webapp/ordermgr/images/js/return.js (original)
> +++ ofbiz/trunk/applications/order/webapp/ordermgr/images/js/return.js Wed Sep 15 17:56:37 2010
> @@ -17,7 +17,7 @@ specific language governing permissions
> under the License.
> */
>
> -Event.observe(window, 'load', function() {
> +document.observe('dom:loaded', function() {
>     Event.observe($('returnHeaderTypeId'), 'change', function() {
>         changeStatusCorrespondingToHeaderType();
>     });
>
> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/order/ordershippinginfo.ftl
> URL: 
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/order/ordershippinginfo.ftl?rev=997420&r1=997419&r2=997420&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/order/webapp/ordermgr/order/ordershippinginfo.ftl (original)
> +++ ofbiz/trunk/applications/order/webapp/ordermgr/order/ordershippinginfo.ftl Wed Sep 15 17:56:37 2010
> @@ -346,7 +346,9 @@ under the License.
>         </form>
>       </div>
>       <script language="JavaScript" type="text/javascript">
> +       document.observe('dom:loaded', function() {
>         new Popup('newShippingAddressForm', 'newShippingAddress', {modal: true, position: 'center', trigger: 'click'})
> +       });
>       </script>
>       <table width="100%" border="0" cellpadding="1" cellspacing="0">
>         <#if shipGroup.supplierPartyId?has_content>
>
> Modified: ofbiz/trunk/applications/party/webapp/partymgr/js/PartyProfileContent.js
> URL: 
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/js/PartyProfileContent.js?rev=997420&r1=997419&r2=997420&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/party/webapp/partymgr/js/PartyProfileContent.js (original)
> +++ ofbiz/trunk/applications/party/webapp/partymgr/js/PartyProfileContent.js Wed Sep 15 17:56:37 2010
> @@ -19,7 +19,7 @@ under the License.
>
> var progressBar;
>
> -Event.observe(window, 'load', function() {
> +document.observe('dom:loaded', function() {
>   Event.observe('uploadPartyContent', 'submit', uploadPartyContent);
>   Event.observe('uploadPartyContent', 'submit', getUploadProgressStatus);
>   progressBar = new Control.ProgressBar('progress_bar');
>
> Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/images/checkoutProcess.js
> URL: 
> http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/images/checkoutProcess.js?rev=997420&r1=997419&r2=997420&view=diff
> ==============================================================================
> --- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/images/checkoutProcess.js (original)
> +++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/images/checkoutProcess.js Wed Sep 15 17:56:37 2010
> @@ -21,7 +21,7 @@ var isShipStepValidate = false;
> var isShipOptionStepValidate = false;
> var isBillStepValidate = false;
>
> -Event.observe(window, 'load', function() {
> +document.observe('dom:loaded', function() {
>     // Cart
>     var validateCart = new Validation('cartForm', {immediate: true, onSubmit: false});
>     var validateShip = new Validation('shippingForm', {immediate: true, onSubmit: false});
>
> Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/images/productAdditionalView.js
> URL: 
> http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/images/productAdditionalView.js?rev=997420&r1=997419&r2=997420&view=diff
> ==============================================================================
> --- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/images/productAdditionalView.js (original)
> +++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/images/productAdditionalView.js Wed Sep 15 17:56:37 2010
> @@ -53,4 +53,4 @@ imgView = {
>         }
>     }
> }
> -Event.observe(window, 'load', imgView.init, false);
> +document.observe('dom:loaded', imgView.init, false);
>
> Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/images/profile.js
> URL: 
> http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/images/profile.js?rev=997420&r1=997419&r2=997420&view=diff
> ==============================================================================
> --- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/images/profile.js (original)
> +++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/images/profile.js Wed Sep 15 17:56:37 2010
> @@ -20,7 +20,7 @@ under the License.
> var validateNewUser = null;
> var validateEditUser = null;
> var validatePostalAddress = null;
> -Event.observe(window, 'load', function() {
> +document.observe('dom:loaded', function() {
>     if ($('newUserForm')) {
>         validateNewUser = new Validation('newUserForm', {immediate: true, onSubmit: false});
>         addValidations();
>
> Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/images/quickAnonCustSettings.js
> URL: 
> http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/images/quickAnonCustSettings.js?rev=997420&r1=997419&r2=997420&view=diff
> ==============================================================================
> --- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/images/quickAnonCustSettings.js (original)
> +++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/images/quickAnonCustSettings.js Wed Sep 15 17:56:37 2010
> @@ -17,13 +17,13 @@ specific language governing permissions
> under the License.
> */
>
> -Event.observe(window, 'load', isValidElement);
> +document.observe('dom:loaded', isValidElement);
>
> function isValidElement(element){
>     var validator = new Validation('quickAnonProcessCustomer',  {immediate : true});
>  }
>
> -Event.observe(window, 'load', function() {
> +document.observe('dom:loaded', function() {
>     Event.observe('useShippingPostalAddressForBilling', 'click', changeText2);
> });
> function changeText2(){
>
> Modified: ofbiz/trunk/specialpurpose/webpos/webapp/webpos/images/js/SearchProducts.js
> URL: 
> http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/webpos/webapp/webpos/images/js/SearchProducts.js?rev=997420&r1=997419&r2=997420&view=diff
> ==============================================================================
> --- ofbiz/trunk/specialpurpose/webpos/webapp/webpos/images/js/SearchProducts.js (original)
> +++ ofbiz/trunk/specialpurpose/webpos/webapp/webpos/images/js/SearchProducts.js Wed Sep 15 17:56:37 2010
> @@ -17,7 +17,7 @@ specific language governing permissions
> under the License.
> */
>
> -Event.observe(window, 'load', function() {
> +document.observe('dom:loaded', function() {
>
>     // Autocompleter for good identification field
>     var j = 0;
>
> Modified: ofbiz/trunk/themes/bizznesstime/webapp/bizznesstime/js/application.js
> URL: 
> http://svn.apache.org/viewvc/ofbiz/trunk/themes/bizznesstime/webapp/bizznesstime/js/application.js?rev=997420&r1=997419&r2=997420&view=diff
> ==============================================================================
> --- ofbiz/trunk/themes/bizznesstime/webapp/bizznesstime/js/application.js (original)
> +++ ofbiz/trunk/themes/bizznesstime/webapp/bizznesstime/js/application.js Wed Sep 15 17:56:37 2010
> @@ -80,7 +80,7 @@ javascript solution to make form focus s
> consistent cross browser form platforms that
> don't support input:focus (cough, cough, IE, cough)
> *****************************************************/
> -Event.observe(window, 'load', function() {
> +document.observe('dom:loaded', function() {
>     var fields = $$("input, textarea");
>     for (var i = 0; i < fields.length; i++) {
>       fields[i].onfocus = function() {this.className += ' focused';}
> @@ -168,7 +168,7 @@ ModalWindow = Class.create({
> });
>
> //LOAD MODAL PREFERENCE WINDOWS
> -Event.observe(window, 'load', function() {
> +document.observe('dom:loaded', function() {
>     get = new ModalWindow();
>     $("language").observe('click',function(e) {
>       var locale = new Element('div', {id:'modal-contents'}).update("<img src='/bizznesstime/images/ajax-loader.gif'/>Updating 
> Languages, please wait...");
>
> Modified: ofbiz/trunk/themes/droppingcrumbs/webapp/droppingcrumbs/js/application.js
> URL: 
> http://svn.apache.org/viewvc/ofbiz/trunk/themes/droppingcrumbs/webapp/droppingcrumbs/js/application.js?rev=997420&r1=997419&r2=997420&view=diff
> ==============================================================================
> --- ofbiz/trunk/themes/droppingcrumbs/webapp/droppingcrumbs/js/application.js (original)
> +++ ofbiz/trunk/themes/droppingcrumbs/webapp/droppingcrumbs/js/application.js Wed Sep 15 17:56:37 2010
> @@ -80,7 +80,7 @@ javascript solution to make form focus s
> consistent cross browser form platforms that
> don't support input:focus (cough, cough, IE, cough)
> *****************************************************/
> -Event.observe(window, 'load', function() {
> +document.observe('dom:loaded', function() {
>     var fields = $$("input, textarea");
>     for (var i = 0; i < fields.length; i++) {
>       fields[i].onfocus = function() {this.className += ' focused';}
> @@ -168,7 +168,7 @@ ModalWindow = Class.create({
> });
>
> //LOAD MODAL PREFERENCE WINDOWS
> -Event.observe(window, 'load', function() {
> +document.observe('dom:loaded', function() {
>     get = new ModalWindow();
>     $("language").observe('click',function(e) {
>       var locale = new Element('div', {id:'modal-contents'}).update("<img src='/bizznesstime/images/ajax-loader.gif'/>Updating 
> Languages, please wait...");
>
> Modified: ofbiz/trunk/themes/tomahawk/includes/appbarClose.ftl
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/themes/tomahawk/includes/appbarClose.ftl?rev=997420&r1=997419&r2=997420&view=diff
> ==============================================================================
> --- ofbiz/trunk/themes/tomahawk/includes/appbarClose.ftl (original)
> +++ ofbiz/trunk/themes/tomahawk/includes/appbarClose.ftl Wed Sep 15 17:56:37 2010
> @@ -108,7 +108,9 @@ under the License.
>
> <#if userLogin?exists>
> <script type="text/javascript">
> + document.observe('dom:loaded', function() {
>   var mainmenu = new DropDownMenu($('main-navigation'));
>   var appmenu = new DropDownMenu($('app-navigation'));
> + });
> </script>
> </#if>
>
>