TOPIC:

Text field validation, accept only few values 3 weeks 4 days ago #262858

  • Topic Author
  • gtgt
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 64
  • Thanks: 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

Please Log in or Create an account to join the conversation.

Text field validation, accept only few values 3 weeks 4 days ago #262860

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 6901
  • Karma: 3
  • Thanks: 492
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

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.040 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!