TOPIC:

Limit field input 2 weeks 23 hours ago #259999

  • Topic Author
  • papin0
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 77
  • Thanks: 0
I'm trying to limit 2 fields input value to >0 and <1000

and onother field value to >0 and <10000

Also validate that is not empty and non 0 values
For example 000 or 0000

TIA

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

Last edit: Post by papin0.

Limit field input 2 weeks 12 hours ago #260005

  • Mirec's Avatar
  • Mirec
  • Offline
  • Expert Breezer
  • Expert Breezer
  • Posts: 206
  • Karma: 2
  • Thanks: 3
Hi,

Please select the field, Go Properties, and scroll down to the Validation, type 'Custom'. For value between >0 and <1000, insert code:
function ff_fieldName_validation(element, message)
{
    if (element.value <= 0 || element.value >1000 || element.value=='') {
        if (message=='') message = element.name+" faild in my test.\n"
        ff_validationFocus(element.name);
        return message;
    } // if
    return '';
} // ff_fieldName_validation

Please instead of 'fieldName' insert the name of the field (no title).


Please select the second field, Go Properties, and scroll down to the Validation, type 'Custom'. For value between >0 and <10000, insert code:
function ff_fieldName_validation(element, message)
{
    if (element.value <= 0 || element.value >10000 || element.value=='') {
        if (message=='') message = element.name+" faild in my test.\n"
        ff_validationFocus(element.name);
        return message;
    } // if
    return '';
} // ff_fieldName_validation

Please instead of 'fieldName' insert the name of the field (no title).

Let me know does it work! :)
Regards!
Mirko

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

Last edit: Post by tihana.krivic. Reason: update: added the validation code for non empty values

Limit field input 1 week 6 days ago #260083

  • Topic Author
  • papin0
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 77
  • Thanks: 0
Worked like a charm thank you.
But now I need to validate a field with this format 999-99-9999
to block the input of 000-00-0000

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

Limit field input 1 week 6 days ago #260084

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

for this you can use masked input field, please check documentation:
crosstec.org/en/support/online-documenta...ked-field-input.html

Regards,
Tihana

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

Limit field input 1 week 6 days ago #260090

  • Topic Author
  • papin0
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 77
  • Thanks: 0
got it
but where do I put my custom definitions?
Ex. this is what I have:
echo '<script src="/includes/js/maskedinput/src/jquery.maskedinput.js"
type="text/javascript"></script>';
echo '<script>
jQuery(function($){
$("#ff_elem3117").mask("99/99/9999",{placeholder:""});
$("#ff_elem2840").mask("(999) 999-9999",{placeholder:""});
$("#ff_elem8240").mask("999-99-9999",{placeholder:""});
$("#ff_elem2842").mask("(999) 999-9999",{placeholder:""});
$("#ff_elem2839").mask("(999) 999-9999",{placeholder:""});
$("#ff_elem2852").mask("(999) 999-9999",{placeholder:""});
$("#ff_elem2854").mask("(999) 999-9999",{placeholder:""});
$("#ff_elem2893").mask("(999) 999-9999",{placeholder:""});
$("#ff_elem2894").mask("(999) 999-9999",{placeholder:""});
$("#ff_elem5152").mask("(999) 999-9999",{placeholder:""});
$("#ff_elem5237").mask("(999) 999-9999",{placeholder:""});
$("#ff_elem5233").mask("(999) 999-9999",{placeholder:""});
$("#ff_elem5250").mask("(999) 999-9999",{placeholder:""});
$("#ff_elem5251").mask("(999) 999-9999",{placeholder:""});
});
</script>';

I want to add a definition to block 0000 from been entered.
$.mask.definitions='[1-9]'; Where do I put this code???

TIA

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

Limit field input 1 week 6 days ago #260091

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

try it like this:
echo '<script src="/includes/js/maskedinput/src/jquery.maskedinput.js"
type="text/javascript"></script>';
echo '<script>
jQuery(function($){
$("#ff_elem3117").mask("99/99/9999",{placeholder:""});
$("#ff_elem2840").mask("(999) 999-9999",{placeholder:""});
$("#ff_elem8240").mask("999-99-9999",{placeholder:""});
$("#ff_elem2842").mask("(999) 999-9999",{placeholder:""});
$("#ff_elem2839").mask("(999) 999-9999",{placeholder:""});
$("#ff_elem2852").mask("(999) 999-9999",{placeholder:""});
$("#ff_elem2854").mask("(999) 999-9999",{placeholder:""});
$("#ff_elem2893").mask("(999) 999-9999",{placeholder:""});
$("#ff_elem2894").mask("(999) 999-9999",{placeholder:""});
$("#ff_elem5152").mask("(999) 999-9999",{placeholder:""});
$("#ff_elem5237").mask("(999) 999-9999",{placeholder:""});
$("#ff_elem5233").mask("(999) 999-9999",{placeholder:""});
$("#ff_elem5250").mask("(999) 999-9999",{placeholder:""});
$("#ff_elem5251").mask("(999) 999-9999",{placeholder:""});
$.mask.definitions='[1-9]'; 
});
</script>';
Regards,
Tihana

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

Moderators: ForumSupport
Time to create page: 0.051 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!