TOPIC:

Value bigger than null 7 months 1 week ago #238551

  • Topic Author
  • Mister.Miracle
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 99
  • Karma: 1
  • Thanks: 1
Hello,

i created a form.
The fieldtype is number input with the extende options only value between 0 and 15 allowed.
it is a * field, so the user has to enter a value.

The script used to check the value is ff_integeramount, so i only should be entered values bigger than 0.

Now the user entered a value -2.
How could this be? I have to create another script to allow only values bigger than 0?

Thank you.

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

Value bigger than null 7 months 1 week ago #238552

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 413
Hello,

You are right, I have just tested it and it allowed me to submit a negative number.

Since you don't only want to stop user from entering negative values, but they also mustn't enter a number greater than 15 I suggest that you write the following Custom Validation script:
function ff_FIELDNAME_validation(element, message)
{   var ex  = /^\+?(0|[1-9]\d*)$/;
    if ( !( ex.test(element.value) && element.value <= 15 && element.value >= 0 ) ) {
        if (message=='') message = "Please enter a positive integer between 0 and 15.\n"
        ff_validationFocus(element.name);
        return message;
    } // if
    return '';
} // ff_FIELDNAME_validation
NOTE: In the code above, you have to replace FIELDNAME with the Name of the "Number input" field in your form.

Regarding the positive integer "ff_integeramount" script, you can adjust the script if you go to BreezingForms > Manage scripts and replace this line of code:
var ex  = /(^-?\d\d*$)/;
with this one:
var ex  = /^\+?(0|[1-9]\d*)$/;

Save the change and the script will work properly.

Let me know whether this is working as you wanted.

Regards,

Mihaela

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

Value bigger than null 7 months 1 week ago #238560

  • Topic Author
  • Mister.Miracle
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 99
  • Karma: 1
  • Thanks: 1
okay. may i be updated in the next version of breezingform automaticaly?

Thank you for explain it and to give the right code :-)
I think i would go to change the ff_intergeramount-script :-)

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

Value bigger than null 7 months 1 week ago #238563

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 413
Hello again,

Yes, we will have in mind that this has to be corrected on the next update.

I'm glad I've helped and that this is working as you wanted. :)

Regards,

Mihaela

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

  • Page:
  • 1
Moderators: ForumSupport
Time to create page: 0.046 seconds

July Sale!

Discounts for all of our extensions + support. Ending July 31st!

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!