TOPIC:

sample script code to customize field content checking 2 months 1 week ago #270868

  • Topic Author
  • alpheratz
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 9
  • Thanks: 0
Hello
May somebody post a simple example of script code to customize verification of a given field of a form.

E.g. : I have a text field named "vegetable" as an element of a form

How should I code the verification that the input is equal to 'lettuce' ?

I think it should look like

// Test de présence de texte dans un champ qui doit rester vide sous peine de tuer le formulaire
$answer = ff_getSubmit('vegetable');
if ( $answer != 'lettuce' ) { blabla eg close the form with message...


.... but I have no idea of how to pack this properly codewise.

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

sample script code to customize field content checking 2 months 1 week ago #270877

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 10074
  • Karma: 3
  • Thanks: 679
Hi,

could you please explain a little better what you want?

E.g. if I understood you correctly, then this could be done on the following way:
1) there is a textfield with name vegatable
2) if someone click on submit button, then it checks if value of this field "vegetable" is "lettuce", if not form is not submitted and there is error message.

You want something like this?

Regards,
Tihana

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

sample script code to customize field content checking 2 months 1 week ago #270916

  • Topic Author
  • alpheratz
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 9
  • Thanks: 0
Yes, this is exactly the question i try to workaround.
Regards,
J-Ph

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

sample script code to customize field content checking 2 months 1 week ago #270923

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 10074
  • Karma: 3
  • Thanks: 679
Hi,

please go to this textfield vegatable->Propertes->Validation->check Custom and put this:
function ff_vegetable_validation(element, message)
{
    if (element.value != "lettuce") {
        if (message=='') message = element.name+" faild in my test.\n"
        ff_validationFocus(element.name);
        return message;
    } // if
    return '';
} // ff_vegetable_validation
Click on Save properties->and Save in blue box.

Make sure that vegatable is name of this textfield (not title)

After that when you click on Submit button and textfield is not equal to lettuce you will see error message

Let me know if you need more help

Regards,
Tihana

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

sample script code to customize field content checking 3 weeks 3 days ago #273229

  • Topic Author
  • alpheratz
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 9
  • Thanks: 0
Thank you very much !
(sorry i have been away from the forms for a while )

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

sample script code to customize field content checking 3 weeks 2 days ago #273239

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 10074
  • Karma: 3
  • Thanks: 679
Hi,

np, I understand :)

If you need anything else, feel free to ask

Regards,
Tihana

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

  • Page:
  • 1
Time to create page: 0.049 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!