Attention: The Collaboratory IAM will down for up to 1 hour on Monday, the 7th of July 2025 starting from 5pm CEST (my timezone) for up to 1 hour. Any and all services, which require a user login with an EBRAINS account, will be un-available during that time


Last modified by marissadiazpier on 2023/09/04 17:22

From version 9.1
edited by marissadiazpier
on 2023/06/25 18:08
Change comment: There is no comment for this version
To version 5.1
edited by marissadiazpier
on 2023/06/25 18:01
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -51,29 +51,39 @@
51 51      </form>
52 52    </div>
53 53  
54 - <script>
55 - document.getElementById('survey-form').addEventListener('submit', function(event) {
56 - event.preventDefault();
54 +  <script>
55 +    function handleDocumentSaved(response) {
56 +      console.log('Documento guardado con éxito:', response);
57 +    }
57 57  
58 - var selectedOption = document.querySelector('input[name="option"]:checked').value;
59 - var results = "Has seleccionado: " + selectedOption;
59 +    function saveResultsToOnlyOffice(results) {
60 +      window.onEditorsReady = function() {
61 +        window.Asc.documentService.upload(
62 +          {
63 +            url: 'https://drive.ebrains.eu/',
64 +            file: results,
65 +            callbackUrl: 'https://drive.ebrains.eu/smart-link/58102a22-49fc-426b-ae8c-daa107489e58/',
66 +            token: '58102a22-49fc-426b-ae8c-daa107489e58',
67 +            success: handleDocumentSaved,
68 +            error: function(response) {
69 +              console.log('Error al guardar el documento:', response);
70 +            }
71 +          }
72 +        );
73 +      };
74 +    }
60 60  
61 - // Realizar una solicitud AJAX al servidor para guardar los datos en el archivo en la nube
62 - $.ajax({
63 - url: 'https://drive.ebrains.eu/smart-link/2052546c-45e8-4d51-847a-fa421a62e57b/', // Reemplaza con la ruta y nombre de tu archivo en la nube
64 - type: 'POST',
65 - data: results,
66 - success: function(response) {
67 - alert('Datos guardados exitosamente en el archivo en la nube.');
68 - },
69 - error: function(xhr, status, error) {
70 - console.error(error);
71 - alert('Error al guardar los datos en el archivo en la nube.');
72 - }
73 - });
74 - });
75 - </script>
76 +    document.getElementById('survey-form').addEventListener('submit', function(event) {
77 +      event.preventDefault();
78 +
79 +      var selectedOption = document.querySelector('input[name="option"]:checked').value;
80 +      var results = "Has seleccionado: " + selectedOption;
81 +
82 +      saveResultsToOnlyOffice(results);
83 +    
84 +     Puedes hacer más acciones aquí, como mostrar un mensaje de agradecimiento o redireccionar al usuario a otra página
85 +    });
86 +  </script>
76 76  </body>
77 77  </html>
78 -
79 79  {{/html}}
Public

SLU_HBPB