TOPIC:

Validierung einer Zahleneingabe 3 years 1 month ago #229658

  • Topic Author
  • Berndi
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 2
  • Thanks: 0
Hallo Experten,

ich versuche mich gerade daran ein Validierungsscript für ein Zahleneingabefeld zu schreiben und scheitere kläglich.

Die Validierung soll prüfen, ob sich die eingegebene Zahl zwischen 1970 und dem aktuellen Jahr befindet.

Hier mein Code:
function ff_judoTA_jahrgang_validation(element, message)
{
    var jetzt = new Date();
    jahr = jetzt.getFullYear();
    
    if (element.value > jahr) or (element.value < 1970) {
        if (message=='') message = element.name+" faild in my test.\n"
        ff_validationFocus(element.name);
        return message;
    } // if
    return '';
} // ff_judoTA_jahrgang_validation
Leider tut sich überhaupt nichts. :-(

Was mache ich falsch?

Gruß,
Berndi

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

Validierung einer Zahleneingabe 3 years 1 month ago #229664

  • DarkoCujic's Avatar
  • DarkoCujic
  • Offline
  • Developer
  • Developer
  • Posts: 2154
  • Karma: 67
  • Thanks: 265
Hey,

I hope we can continue in English.

You did good except for one line. The keyword "or" isn't used in javascript, so please change this line:
if (element.value > jahr) or (element.value < 1970) {
to this:
if ((element.value > jahr) || (element.value < 1970)) {

Let me know if it works now.

Kind regards,
Darko
Satisfied with our support? PayPal tips
===========
Need to renew Pro Support? Buy Here!
===========
Satisfied? Consider a membership!
===========
Like us on Facebook
===========
Support Crosstec and get ALL EXTENSIONS and professional support for just $5. Here!

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

Validierung einer Zahleneingabe 3 years 1 month ago #229669

  • Topic Author
  • Berndi
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 2
  • Thanks: 0
It works.
Many thanks!

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

Validierung einer Zahleneingabe 3 years 1 month ago #229670

  • DarkoCujic's Avatar
  • DarkoCujic
  • Offline
  • Developer
  • Developer
  • Posts: 2154
  • Karma: 67
  • Thanks: 265
You're welcome. Let us know should you need anything else.

Kind regards,
Darko
Satisfied with our support? PayPal tips
===========
Need to renew Pro Support? Buy Here!
===========
Satisfied? Consider a membership!
===========
Like us on Facebook
===========
Support Crosstec and get ALL EXTENSIONS and professional support for just $5. Here!
The following user(s) said Thank You: Berndi

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

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