Changeset 964


Ignore:
Timestamp:
Oct 23, 2020, 3:37:00 PM (4 years ago)
Author:
djay
Message:

Update index.html to display part of the form that are not validated when producing the execute request.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-project/zoo-services/utils/open-api/templates/index.html

    r962 r964  
    611611          System[i]();
    612612        }
    613          System["JSON_STR"]=JSON.parse(tmpStr);
    614          var forms = document.getElementsByClassName('needs-validation');
    615          // Loop over them and prevent submission
    616          var validation = Array.prototype.filter.call(forms, function(form) {
    617       form.addEventListener('submit', function(event) {
    618              event.preventDefault();
    619              event.stopPropagation();
    620              if (form.checkValidity() === false) {
    621                event.preventDefault();
    622       event.stopPropagation();
    623       alert('ok');
    624              }else{
    625                loadRequest();
    626              }
    627              form.classList.add('was-validated');
    628            }, false);
    629          });
     613        System["JSON_STR"]=JSON.parse(tmpStr);
     614        var forms = document.getElementsByClassName('needs-validation');
     615        // Loop over them and prevent submission
     616        var validation = Array.prototype.filter.call(forms, function(form) {
     617          form.addEventListener('submit', function(event) {
     618            event.preventDefault();
     619            event.stopPropagation();
     620            if (form.checkValidity() === false) {
     621              event.preventDefault();
     622              event.stopPropagation();
     623              for(var i=0;i<System["JSON_STR"]["inputs"].length;i++){
     624                var cName=System["JSON_STR"]["inputs"][i]["id"].replace(/\./g,"_");
     625                var selector=
     626                  'input[name="input_value_'+cName+'"]:invalid,'+
     627                  'select[name="input_value_'+cName+'"]:invalid';
     628                if(\$(selector).length>0){
     629                  \$(selector).each(function(){
     630                    \$(this).parent().parent().parent().parent().find(".btn").first().click();
     631                  });
     632                  console.log(System["JSON_STR"]["inputs"][i]["id"]);
     633                }
     634              }             
     635            }else{
     636              loadRequest();
     637            }
     638            form.classList.add('was-validated');
     639          }, false);
     640        });
    630641     
    631642      }
     
    633644      <hr>
    634645      <address>$openapi["openapi"]["rootUrl"]$(currentUrl).html</address>
    635       <!-- hhmts start -->Last modified: Wed Oct 21 17:23:48 CEST 2020 <!-- hhmts end -->
     646      <!-- hhmts start -->Last modified: Thu Oct 22 14:21:02 CEST 2020 <!-- hhmts end -->
    636647    </main>
    637648#if $currentKey=="root"
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png