Author: jfthomps
Date: Fri Nov  7 20:20:05 2014
New Revision: 1637442

URL: http://svn.apache.org/r1637442
Log:
VCL-776 - rework resource code to have a base class for all resources and 
inheriting classes for each resource type

image.js: modified saveResource: added code to expand Advanced Options section 
if there is an error with one of the form elements inside it and then to put 
the focus on that item so that the error popup gets displayed. had a problem 
where submitting changed to an image with Advanced Options closed but with an 
error in that data made it seem like the Save Changes button did not work.

Modified:
    vcl/trunk/web/js/resources/image.js

Modified: vcl/trunk/web/js/resources/image.js
URL: 
http://svn.apache.org/viewvc/vcl/trunk/web/js/resources/image.js?rev=1637442&r1=1637441&r2=1637442&view=diff
==============================================================================
--- vcl/trunk/web/js/resources/image.js (original)
+++ vcl/trunk/web/js/resources/image.js Fri Nov  7 20:20:05 2014
@@ -131,16 +131,36 @@ function saveResource() {
        }
        if(! checkValidatedObj('owner', errobj))
                return;
-       if(! checkValidatedObj('ram', errobj))
+       if(! checkValidatedObj('ram', errobj)) {
+               if(! dijit.byId('advancedoptions').open)
+                       dijit.byId('advancedoptions').toggle();
+               setTimeout(function() {dijit.byId('ram').focus();}, 300);
                return;
-       if(! checkValidatedObj('cores', errobj))
+       }
+       if(! checkValidatedObj('cores', errobj)) {
+               if(! dijit.byId('advancedoptions').open)
+                       dijit.byId('advancedoptions').toggle();
+               setTimeout(function() {dijit.byId('cores').focus();}, 300);
                return;
-       if(! checkValidatedObj('cpuspeed', errobj))
+       }
+       if(! checkValidatedObj('cpuspeed', errobj)) {
+               if(! dijit.byId('advancedoptions').open)
+                       dijit.byId('advancedoptions').toggle();
+               setTimeout(function() {dijit.byId('cpuspeed').focus();}, 300);
                return;
-       if(! checkValidatedObj('concurrent', errobj))
+       }
+       if(! checkValidatedObj('concurrent', errobj)) {
+               if(! dijit.byId('advancedoptions').open)
+                       dijit.byId('advancedoptions').toggle();
+               setTimeout(function() {dijit.byId('concurrent').focus();}, 300);
                return;
-       if(! checkValidatedObj('reload', errobj))
+       }
+       if(! checkValidatedObj('reload', errobj)) {
+               if(! dijit.byId('advancedoptions').open)
+                       dijit.byId('advancedoptions').toggle();
+               setTimeout(function() {dijit.byId('reload').focus();}, 300);
                return;
+       }
 
        if(dojo.byId('editresid').value == 0)
                var data = {continuation: dojo.byId('addresourcecont').value};


Reply via email to