Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

142
Vistas
Popup message on the user interface

[![enter image description here][1]][1] In this method how can I check if the formkey attribute actually has a value and if it does not then change the status from "saving" to "failing" and a popup message to the user that the particular user task has no form key?

function saveWorkflow () {
      $('#dbs-debug').html('Saving...');
// **************************************************************

      process.id = 'process_' + _flowId;
      process.name = _flowName;
      $('#dbs-form-content > .dbs-form-task').each(function () {
        var userTask = {};
        userTask.name = $(this).attr('data-name');
        userTask.id = $(this).attr('data-id');
        userTask.condition = $(this).attr('data-condition');

        if ($(this).attr('data-type') === "user-task") {
// **************************************************************
          userTask.formKey = $(this).attr('data-formkey');
// **************************************************************
          userTask.cUsers = $(this).attr('data-cusers');
          userTask.cGroups = $(this).attr('data-cgroups');
          userTask.rejstep = $(this).attr('data-rejstep');
          userTask.due = $(this).attr('data-due');
          userTask.reassignment = $(this).attr('data-reassignment');
        } else if ($(this).attr('data-type') === "email-task") {
          userTask.email = $(this).attr('data-email');
        }
        userTask.type = $(this).attr('data-type');
        process.userTasks.push(userTask);
      });


    }


 


  [1]: https://i.stack.imgur.com/aml39.png
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I would make the formKey required and use the form submit event to save.

Then the code would not even be executed.

Otherwise

function saveWorkflow() {
  $('#dbs-debug').html('Saving...');
  let formKeyError = false;
  // **************************************************************
  process.id = 'process_' + _flowId;
  process.name = _flowName;
  process.userTasks = $('#dbs-form-content > .dbs-form-task').map(function() {
    const userTask = {
      name: $(this).attr('data-name'),
      type: $(this).attr('data-type')
      id: $(this).attr('data-id'),
      condition: $(this).attr('data-condition')
    };

    if ($(this).attr('data-type') === "user-task") {
      // **************************************************************
      const formKey = $(this).attr('data-formkey');
      if (formKey) userTask.formKey = formKey;
      else formKeyError = true;

      // **************************************************************
      userTask.cUsers = $(this).attr('data-cusers');
      userTask.cGroups = $(this).attr('data-cgroups');
      userTask.rejstep = $(this).attr('data-rejstep');
      userTask.due = $(this).attr('data-due');
      userTask.reassignment = $(this).attr('data-reassignment');
    } else if ($(this).attr('data-type') === "email-task") {
      userTask.email = $(this).attr('data-email');
    }
    return userTask
  }).get()
  if (formKeyError) {
     $('#dbs-debug').html('form key missing, saving aborted');
  } else {
    // save here
  }
}
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda