Lightbox template inputs validation

Hello everybody,

I’m using a template as a custom control in Lightbox, in which I have several input fields (all texts), and I need to check their values when I click save button.

My current code is as following:

scheduler.config.lightbox.sections=[
    {name:"contact", height: 250, map_to:"lead_template", type:"template"}   
  ]

scheduler.attachEvent("onBeforeLightbox", function(id) {
    var event = scheduler.getEvent(id);
    var leadNome = event.lead !== undefined ? event.lead.nome : '';
    var leadCognome = event.lead !== undefined ? event.lead.cognome : '';
    var leadTelefono = event.lead !== undefined ? event.lead.telefono : '';
    var leadVia = event.lead !== undefined && event.lead.indirizzo !== undefined ? event.lead.indirizzo.via : '';
    var leadNumero = event.lead !== undefined && event.lead.indirizzo ? event.lead.indirizzo.numero : '';
    var leadCitta = event.lead !== undefined && event.lead.indirizzo ? event.lead.indirizzo.citta : '';
    var leadCap = event.lead !== undefined && event.lead.indirizzo ? event.lead.indirizzo.cap : '';
    var leadProvincia = event.lead !== undefined && event.lead.indirizzo ? event.lead.indirizzo.provincia : '';
    var leadProfessione = event.lead !== undefined ? event.lead.professione : '';
    var affiancatoreNome = event.affiancatore !== undefined ? event.affiancatore.nome : '';
    var affiancatoreCognome = event.affiancatore !== undefined ? event.affiancatore.cognome : '';
    event.lead_template = '<input type="text" name="nome" value="' + leadNome + '" placeholder="Nome">&nbsp;' +
                          '<input type="text" name="cognome" value="' + leadCognome + '" placeholder="Cognome"><br>' +
                          '<input type="text" name="telefono" value="' + leadTelefono + '" placeholder="Telefono" style="margin-top:10px;"><br><br>' +
                          '<input type="text" name="via" value="' + leadVia + '" placeholder="Via"><br>' +
                          '<input type="text" name="numero" value="' + leadNumero + '" placeholder="Numero" style="margin-top:10px;">&nbsp;' +
                          '<input type="text" name="citta" value="' + leadCitta + '" placeholder="Citta" style="margin-top:10px;"><br>' +
                          '<input type="text" name="cap" value="' + leadCap + '" placeholder="Cap" style="margin-top:10px;">&nbsp;' +
                          '<input type="text" name="provincia" value="' + leadProvincia + '" placeholder="Provincia" style="margin-top:10px;"><br><br>' +
                          '<input type="text" name="professione" value="' + leadProfessione + '" placeholder="Professione">';
    return true;
  });

scheduler.attachEvent("onEventSave", function(id,event,isNew) {
    
      // TODO check event.lead_templete here
      return true;
  });

I need to check the value of field “nome”, for example. I couldn’t figure out how to do it.
In onEventSave I tried with alert(event.lead_template); but its output is simply the html code I passed at the beginning, without the actual values.

Hello,
the template section does not return values of a template section to an event.
What you can do is retrieve values manually from html elements. You can get the top node using scheduler.formSection method and than use some selector to retrieve inputs and their values
docs.dhtmlx.com/scheduler/api__s … ction.html