Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Formulario de registro

  • brauliofirpo77
  • brauliofirpo77's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 6 months ago #206179 by brauliofirpo77
Formulario de registro was created by brauliofirpo77
Estimados, buen día

Los molesto por lo siguiente: necesito hacer que en el formulario de inscripción a la encuesta sean obligatorios TODOS los campos (Nombre, Apellido y Email)

Lo que hice hasta ahora fue modificar el comportamiento del boton "register_button" con el siguiente codigo en custom.js
Code:
$('#register_button').click(function(e){
 
      if ($('#register_firstname').val().length ==0 ||
      $('#register_lastname').val().length ==0 ||
      $('#register_email').val().length ==0){
          alert ('Todos los campos son obligatorios');
            return false;
      }
 
});

Entonces, cuando hago click en el boton "Continuar" me aparece un alert de JS en el que me dice que tengo que completar todos los campos. (ver fig uno)

El funcionamiento me sirve, lo que me estaría faltando es

1. Poner un asterisco en todos los campos, igual que en el de email
2. De ser posible, usar un modal como los que usa LS cuando hay algun error de validación de alguna pregunta

Es posible?
Attachments:
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 6 months ago #206181 by Joffm
Replied by Joffm on topic Formulario de registro
Hola,
en "register_form.twig"

cambia de:
Code:
{# Participants first name #}
        <div class='{{ aSurveyInfo.class.registerformcolrow }} form-group row' {{ aSurveyInfo.attr.registerformcolrow }}>
            <label for='register_firstname' class='{{ aSurveyInfo.class.registerformcolrowlabel }} control-label '>{{ gT("First name:") }}</label>
            <div class="">
                {{ C.Html.textField('register_firstname', aSurveyInfo.sFirstName, ({'id' : 'register_firstname','class' : 'form-control'})) }}
            </div>
        </div>
 
        {# Participants last name #}
        <div class='{{ aSurveyInfo.class.registerformcolrowb }} form-group row' {{ aSurveyInfo.attr.registerformcolrowb }}>
            <label {{ aSurveyInfo.attr.registerformcolrowblabel }}  class='{{ aSurveyInfo.class.registerformcolrowblabel }} control-label '>{{ gT("Last name:") }}</label>
            <div {{ aSurveyInfo.attr.registerformcolrowbdiv }} >
                {{ C.Html.textField('register_lastname', aSurveyInfo.sLastName, ({'id' : 'register_lastname', 'class' : 'form-control'})) }}
            </div>
        </div>
 
        {# Participants email #}
        <div class='{{ aSurveyInfo.class.registerformcolrowc }} form-group row' {{ aSurveyInfo.attr.registerformcolrowc }}>
            <label {{ aSurveyInfo.attr.registerformcolrowclabel }} class='{{ aSurveyInfo.class.registerformcolrowclabel }}  control-label'> {{ gT("Email address:") }} {{ include('./subviews/registration/required.twig') }}</label>
            <div {{ aSurveyInfo.attr.registerformcolrowcdiv }}  >
                {{ C.Html.textField('register_email', aSurveyInfo.sEmail, ({'id' : 'register_email','class' : 'form-control input-sm','required' : true})) }}
            </div>
        </div>
a:
Code:
{# Participants first name #}
        <div class='{{ aSurveyInfo.class.registerformcolrow }} form-group row' {{ aSurveyInfo.attr.registerformcolrow }}>
            <label for='register_firstname' class='{{ aSurveyInfo.class.registerformcolrowlabel }} control-label '>{{ gT("First name:") }} {{ include('./subviews/registration/required.twig') }}</label>
            <div class="">
                {{ C.Html.textField('register_firstname', aSurveyInfo.sFirstName, ({'id' : 'register_firstname','class' : 'form-control','required' : true})) }}
            </div>
        </div>
 
        {# Participants last name #}
        <div class='{{ aSurveyInfo.class.registerformcolrowb }} form-group row' {{ aSurveyInfo.attr.registerformcolrowb }}>
            <label {{ aSurveyInfo.attr.registerformcolrowblabel }}  class='{{ aSurveyInfo.class.registerformcolrowblabel }} control-label '>{{ gT("Last name:") }} {{ include('./subviews/registration/required.twig') }}</label>
            <div {{ aSurveyInfo.attr.registerformcolrowbdiv }} >
                {{ C.Html.textField('register_lastname', aSurveyInfo.sLastName, ({'id' : 'register_lastname', 'class' : 'form-control','required' : true})) }}
            </div>
        </div>
 
        {# Participants email #}
        <div class='{{ aSurveyInfo.class.registerformcolrowc }} form-group row' {{ aSurveyInfo.attr.registerformcolrowc }}>
            <label {{ aSurveyInfo.attr.registerformcolrowclabel }} class='{{ aSurveyInfo.class.registerformcolrowclabel }}  control-label'> {{ gT("Email address:") }} {{ include('./subviews/registration/required.twig') }}</label>
            <div {{ aSurveyInfo.attr.registerformcolrowcdiv }}  >
                {{ C.Html.textField('register_email', aSurveyInfo.sEmail, ({'id' : 'register_email','class' : 'form-control input-sm','required' : true})) }}
            </div>
        </div>



Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • brauliofirpo77
  • brauliofirpo77's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 6 months ago #206319 by brauliofirpo77
Replied by brauliofirpo77 on topic Formulario de registro
Estimado,

Estoy usando la versión Versión 4.2.0+200422 (dato que no habia aclarado antes)

Ese archivo, no lo veo en el editor de temas... sera que tengo que bajarlo via ftp y hacer las modificaciones que me contas?
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 6 months ago #206325 by Joffm
Replied by Joffm on topic Formulario de registro
No, entiendo.
Estás usando un tema extendido?





Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: brauliofirpo77
The topic has been locked.
  • brauliofirpo77
  • brauliofirpo77's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 6 months ago #206326 by brauliofirpo77
Replied by brauliofirpo77 on topic Formulario de registro
no... entonces debería extender el tema.

Muchas gracias!
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose