Bienvenido, Invitado
Recordarme

TEMA:

Text field validation, accept only few values 1 mes 3 semanas antes #262858

  • Autor del tema
  • gtgt
  • Fuera de línea
  • Junior Breezer
  • Junior Breezer
  • Mensajes: 64
  • Gracias recibidas: 1
Dear Crosstec!

We organise a conference and use e Breezing form to order tickets.

We have special tickets for the presenters quests and the sponsors quest and organisers. They get a promotional code via email (e.g PGUEST002 or SGUEST005 or ORGANISER003) and they have to enter it to a text field (element name: SPECJEGY.

We have validate this field. I would like to create a script which only allows to submit the form when the entered valeu of SPECJEGY text field starts with "PGUEST" or "SGUEST" or "ORGANISER". any other case gives back a message "Invalid promotional code".

Is it possible ? How can I do it?


Thanks in advance

Tamas

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

Text field validation, accept only few values 1 mes 3 semanas antes #262860

  • Avatar de tihana.krivic
  • tihana.krivic
  • Fuera de línea
  • Moderator
  • Moderator
  • Mensajes: 7381
  • Karma: 3
  • Gracias recibidas: 529
Hi,

please go to your textfield-Properties-Validation-check Custom and put this:
function ff_SPECJEGY_validation(element, message)
{
    var string=/^(PGUEST|SGUEST|ORGANISER).*$/
    if (string.test(element.value)) return '';
        if (message=='') message = element.name+"invalid promotial code.\n"
        ff_validationFocus(element.name);
        return message;
   
    
} // ff_SPECJEGY_validation
Please make sure that SPECJEGY is name of that textfield (not title)

Let me know if you need more help

Regards,
Tihana

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

  • Página:
  • 1
Tiempo de carga de la página: 0.048 segundos