Value bigger than null

  • Mister.Miracle
  • Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Posts: 94
  • Karma: 1
  • Thank you received: 1

Mister.Miracle created the topic: Value bigger than null

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.
#238551
  • Posts: 2785
  • Karma: 95
  • Thank you received: 376

mihaela replied the topic: Value bigger than null

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
#238552
  • Mister.Miracle
  • Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Posts: 94
  • Karma: 1
  • Thank you received: 1

Mister.Miracle replied the topic: Value bigger than null

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 :-)
#238560
  • Posts: 2785
  • Karma: 95
  • Thank you received: 376

mihaela replied the topic: Value bigger than null

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
#238563
Moderators: ForumSupporttomeperica
Time to create page: 0.054 seconds

New Icon Packs Category!

Crosstec is now offering icon packs.

If you are a paying subscriber, icon packs are automatically added to your account.

Check out our icon packs page!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Summer Sale!

50% discount on all of our extension subscription plans, templates and icon packs!

Get Your Subscription Here

News and Updates

Get informed about new downloads, updates and more in our News and Updates newsletter.

All Extensions Subscription

Get 1 year access to all of our current and future products and 1 year of professional support -- 99 for just 49! (Summer Sale)

No support per domain or website installation limits! Includes all of our current and future Joomla!® extensions, Joomla!® templates for the duration of your membership. This means, by purchasing an All Extensions Subscription you'll have it all covered!

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!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here