Changeset 504 for tapas/web/project
- Timestamp:
- 05/11/12 12:34:56 (12 years ago)
- Location:
- tapas/web/project
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
tapas/web/project/formTapas.jsp
r500 r504 40 40 <div class="containerForm" id="formulaire"></div> 41 41 42 <div id="errForm" class="errorsForm"></div>43 42 44 43 <script type="text/javascript"> … … 99 98 100 99 tapasTexts["label.delButton"] = "<spring:message code="label.delButton"/>"; 100 tapasTexts["label.confirm.del"] = "<spring:message code="label.confirm.del"/>"; 101 tapasTexts["text.erreur.saisie"] = "<spring:message code="text.erreur.saisie"/>"; 102 tapasTexts["label.title.add"] = "<spring:message code="label.title.add"/>"; 103 tapasTexts["label.title.del"] = "<spring:message code="label.title.del"/>"; 101 104 102 105 var interfaceTapas = new InterfaceTapas( ${jSonFileFormats}, ${jSonYesNos}, ${jSonObservatories}, ${jSonSpectralUnits}, ${jSonInstrumentalFunctions}, ${jSonClimatoReferences} ); -
tapas/web/project/formTapas_script.jsp
r503 r504 7 7 /** *********** CONTAINERS *********** **/ 8 8 this.containerForm = $( "#formulaire" ); 9 this.containerErrors = $( "#errForm" ); 9 //this.containerErrors = $( "#errForm" ); 10 //this.divE= $( "#divErreurs"); 10 11 this.containerCenter = $( "#containerCenter" ); 11 12 this.containerTabs = $( "#tab" ); … … 36 37 // Buttons 37 38 var submitButton = new Button( {value:tapasTexts["label.submitButton"], parent:this.containerCenter, id:"button_submit", className: "red_button", classNameText:"red_button_text", onClick:jQuery.proxy( this.onClickSubmit, this )} ); 38 this.addRequestButton = new Button( { value:tapasTexts["label.addButton"], parent:this.containerCenter, id:"button_add", className: "positive", onClick:jQuery.proxy( this.onClickAdd, this )} );39 this.delRequestButton = new Button( { value:tapasTexts["label.delButton"], parent:this.containerCenter, id:"button_del", className: "negative", onClick:jQuery.proxy( this.onClickDel, this )} );39 this.addRequestButton = new Button( {title:tapasTexts["label.title.add"],value:tapasTexts["label.addButton"], parent:this.containerCenter, id:"button_add", className: "positive", onClick:jQuery.proxy( this.onClickAdd, this )} ); 40 this.delRequestButton = new Button( {title:tapasTexts["label.title.del"],value:tapasTexts["label.delButton"], parent:this.containerCenter, id:"button_del", className: "negative", onClick:jQuery.proxy( this.onClickDel, this )} ); 40 41 this.delRequestButton.disable(); 41 42 42 43 this.createForm(); 43 44 this.tabActive = this.createTab(); 44 45 this.containerErrors.hide(); 46 }, 47 45 this.divE = $( document.createElement( "div" ) ); 46 this.divE.attr( {id:"divErrors", class:"errorsForm"} ); 47 /*var fieldSetE = $( document.createElement( "fieldset" ) ); 48 fieldSetE.addClass( "cfs3" ); 49 this.divE.append( fieldSetE );*/ 50 51 this.containerForm.append( this.divE ); 52 //this.containerErrors.hide(); 53 this.divE.hide(); 54 55 56 }, 48 57 49 58 … … 90 99 if( !currentDate ) 91 100 currentDate = new Date(); 101 92 102 $( "#" + inputDateId ).val( this.calendarConverter.format( currentDate ) ); 93 103 $( "#" + inputDateId ).addClass( "calendar" ); … … 254 264 error: jQuery.proxy( this.showErrors, this ) 255 265 } ); 266 256 267 }, 257 268 … … 260 271 handleCreateXML: function( result ) 261 272 { 262 // TODO : gérer le bob ?? 263 var bob = jQuery.parseJSON( result ).result; 264 alert( bob ); 273 var res = jQuery.parseJSON( result ).result; 274 alert( res ); 265 275 }, 266 276 … … 269 279 onClickSubmit: function() 270 280 { 271 // if( this.validFields() ) 272 // { 273 // if( confirm( tapasTexts["confirm"] ) ) 274 // { 275 // this.containerErrors.hide(); 276 this.requestCreateXML(); 277 // } 278 // } 281 if( this.validFields() ) 282 { 283 this.divE.hide(); 284 if( confirm( tapasTexts["confirm"] ) ) 285 this.requestCreateXML(); 286 } 279 287 }, 280 288 … … 282 290 onClickAdd: function() 283 291 { 284 this. containerErrors.hide();292 this.divE.hide(); 285 293 this.nbRequest++; 286 294 … … 300 308 onClickDel: function() 301 309 { 302 // TODO : enlever le pouet 303 if( confirm( "pouet" ) ) 310 if( confirm( tapasTexts["label.confirm.del"] ) ) 304 311 { 305 312 var numCurrent = this.numRequest; … … 458 465 createForm: function() 459 466 { 460 this.divErreurs = $( document.createElement( "div" ) );461 this.divErreurs.addClass( "errorsForm" );462 this.divErreurs.hide();463 467 464 468 var divAll = $( document.createElement( "div" ) ); … … 514 518 515 519 this.containerForm.append( divAll ); 516 this.containerForm.append( this.divE rreurs);520 this.containerForm.append( this.divE ); 517 521 //this.tabInput = new Array(3); 518 522 … … 653 657 validFields: function() 654 658 { 655 var testOk = isSup( this.selectObservatories.getValue(), 0 ); 656 if( !testOk ) 659 for( var i = 1; i <= this.nbRequest; i++ ) 657 660 { 658 this.containerErrors.html( tapasTexts["label.observatory"] + " : " + tapasTexts["text.toselect"] ); 659 this.containerErrors.show(); 660 return false; 661 662 var chaine = tapasTexts["text.erreur.saisie"] + " " + i + "<br>"; 663 var testOk = isSup( this.selectObservatoriesList[i].getValue(), 0 ); 664 if( !testOk ) 665 { 666 this.divE.html( chaine + tapasTexts["label.observatory"] + " : " + tapasTexts["text.toselect"] ); 667 this.divE.show(); 668 return false; 669 } 670 671 testOk = isDiff( this.selectSpectralUnitsList[i].getValue(), -1 ); 672 if( !testOk ) 673 { 674 this.divE.html( chaine + tapasTexts["label.spectralUnit"] + " : " + tapasTexts["text.toselect"] ); 675 this.divE.show(); 676 return false; 677 } 678 679 testOk = isValidRange( $( "#iminspectral_ranger_" + i ).val(), $( "#imaxspectral_ranger_" + i ).val(), this.selectSpectralUnitsList[i].getValue() ); 680 if( !testOk ) 681 { 682 this.divE.html( chaine + tapasTexts["label.spectralRange"] + " : " + tapasTexts["text.badvalue"] ); 683 this.divE.show(); 684 return false; 685 } 686 687 testOk = isDeg( $( "#ide_" + i ).val() ); 688 if( !testOk ) 689 { 690 this.divE.html( chaine + tapasTexts["label.ide"] + " : " + tapasTexts["text.badvalue"] ); 691 this.divE.show(); 692 return false; 693 } 694 695 testOk = isValidNum( $( "#iza_" + i ).val() ); 696 if( !testOk ) 697 { 698 this.divE.html( chaine + tapasTexts["label.iza"] + " : " + tapasTexts["text.badvalue"] ); 699 this.divE.show(); 700 return false; 701 } 702 703 testOk = isBetween( $( "#iza_" + i ).val(), 0, 90 ); 704 if( !testOk ) 705 { 706 this.divE.html( chaine + tapasTexts["label.iza"] + " : " + tapasTexts["text.badvalue"] ); 707 this.divE.show(); 708 return false; 709 } 710 711 testOk = isValidNum( $( "#irp_" + i ).val() ); 712 if( !testOk ) 713 { 714 this.divE.html( chaine + tapasTexts["label.resolution"] + " : " + tapasTexts["text.badvalue"] ); 715 this.divE.show(); 716 return false; 717 } 718 719 testOk = isSup( $( "#irp_" + i ).val(), 1 ); 720 if( !testOk ) 721 { 722 this.divE.html( chaine + tapasTexts["label.resolution"] + " : " + tapasTexts["text.badvalue"] ); 723 this.divE.show(); 724 return false; 725 } 726 727 testOk = isValidNum( $( "#isr_" + i ).val() ); 728 if( !testOk ) 729 { 730 this.divE.html( chaine + tapasTexts["label.ratio"] + " : " + tapasTexts["text.badvalue"] ); 731 this.divE.show(); 732 return false; 733 } 734 735 testOk = isSup( $( "#isr_" + i ).val(), 1 ); 736 if( !testOk ) 737 { 738 this.divE.html( chaine + tapasTexts["label.ratio"] + " : " + tapasTexts["text.badvalue"] ); 739 this.divE.show(); 740 return false; 741 } 661 742 } 662 743 663 testOk = isDiff( this.selectSpectralUnits.getValue(), -1 ); 664 if( !testOk ) 665 { 666 this.containerErrors.html( tapasTexts["label.spectralUnit"] + " : " + tapasTexts["text.toselect"] ); 667 this.containerErrors.show(); 668 return false; 669 } 670 671 testOk = isValidRange( $( "#iminspectral_ranger" ).val(), $( "#imaxspectral_ranger" ).val(), this.selectSpectralUnits.getValue() ); 672 if( !testOk ) 673 { 674 this.containerErrors.html( tapasTexts["label.spectralRange"] + " : " + tapasTexts["text.badvalue"] ); 675 this.containerErrors.show(); 676 return false; 677 } 678 679 testOk = isDeg( $( "#ide" ).val() ); 680 if( !testOk ) 681 { 682 this.containerErrors.html( tapasTexts["label.ide"] + " : " + tapasTexts["text.badvalue"] ); 683 this.containerErrors.show(); 684 return false; 685 } 686 687 testOk = isValidNum( $( "#iza" ).val() ); 688 if( !testOk ) 689 { 690 this.containerErrors.html( tapasTexts["label.iza"] + " : " + tapasTexts["text.badvalue"] ); 691 this.containerErrors.show(); 692 return false; 693 } 694 695 testOk = isBetween( $( "#iza" ).val(), 0, 90 ); 696 if( !testOk ) 697 { 698 this.containerErrors.html( tapasTexts["label.iza"] + " : " + tapasTexts["text.badvalue"] ); 699 this.containerErrors.show(); 700 return false; 701 } 702 703 testOk = isValidNum( $( "#irp" ).val() ); 704 if( !testOk ) 705 { 706 this.containerErrors.html( tapasTexts["label.resolution"] + " : " + tapasTexts["text.badvalue"] ); 707 this.containerErrors.show(); 708 return false; 709 } 710 711 testOk = isSup( $( "#irp" ).val(), 1 ); 712 if( !testOk ) 713 { 714 this.containerErrors.html( tapasTexts["label.resolution"] + " : " + tapasTexts["text.badvalue"] ); 715 this.containerErrors.show(); 716 return false; 717 } 718 719 testOk = isValidNum( $( "#isr" ).val() ); 720 if( !testOk ) 721 { 722 this.containerErrors.html( tapasTexts["label.ratio"] + " : " + tapasTexts["text.badvalue"] ); 723 this.containerErrors.show(); 724 return false; 725 } 726 727 testOk = isSup( $( "#isr" ).val(), 1 ); 728 if( !testOk ) 729 { 730 this.containerErrors.html( tapasTexts["label.ratio"] + " : " + tapasTexts["text.badvalue"] ); 731 this.containerErrors.show(); 732 return false; 733 } 744 return true; 734 745 }, 735 746 … … 741 752 this.delRequestButton.disable(); 742 753 743 if( 9<= this.nbRequest )754 if( 10 <= this.nbRequest ) 744 755 this.addRequestButton.disable(); 745 756 else
Note: See TracChangeset
for help on using the changeset viewer.