Great Ideas. Always Flowing.

We are not happy until you are happy. Client satisfaction guaranteed. Whatever your needs and requirements, we have the skills and resources for the job!

Quick login...


Or... now make it easy with Facebook Integration
Connect via Facebook



Top Sellers

Frustrated over the lack of customization for your user's registration fields? Dynamically setup your DNN Portal with custom registration fields, layout, questions, and other core integration options......

Ultra Video Gallery is a brother product of Ultra Media Gallery, UVG allows you to upload videos in various format and automatically encode them to flv or H264 format, you also can add videos from internet or record live videos from your webcam.

Build high performance, completely customizable data-entry forms and views driven by your DNN and external databases. New built-in tools make it a snap to quickly create data entry forms, data views, and even database tables. Plus, add your own HTML, CSS, Javascript, SQL commands, stored procedures,

The most advanced DotNetNuke shopping cart on the planet. Easy to use e-Commerce, Secure Shopping Cart Software and SEO friendly. B2C / B2B Ecommerce Sites.

One stop solution for events calendar and events registration! FREE DOWNLOAD is available now!

Client Side Event - Is Number In Range
Last Post 09-10-2012 05:03 PM by Chad Nash. 3 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages Not Resolved
Brett LevertUser is Offline
skipping stones
skipping stones
Posts:11
Avatar

--
09-01-2012 12:20 PM
    Hello all,

    Just a quick disclaimer: I have zero JavaScript experience so it is probably a stupid mistake I'm making. I apologise in advance.

    I'm trying to check several textinputs to make sure that there is a number entered and it is within a specific range. The range will be different on each field and can include up to one decimal.

    I have added a function to the to javascript file that looks like this:

    function validateInRange(str, min, max) {
      n = parseFloat(str);
      return(!isNaN(n) && n >= min && n <= max);
    }

    and on the first field I want to validate, with the short name "Neck" I have this code in the Advanced Field Options -> Client Side Event:

    function validateFieldRange()
    {
      if(!validateInRange($(Neck), 10, 20)) {
        alert("Please enter a value between 10 and 20");
        return false;
      }
    }

    I also tried without the function:

      if(!validateInRange($(Neck), 10, 20)) {
        alert("Please enter a value between 10 and 20");
        return false;
      }

    The code is appearing in the rendered form HTML but it is not being called and not generating the alert or any error.

    I have enabled client side validation in the form configuration.

    Can anyone suggest what steps to take to get this to work? Or another solution to my problem would be great. If there is a simpler way than this JavaScript to check a field for a number and within a certain range.

    All help is greatly appreciated!
    Brett LevertUser is Offline
    skipping stones
    skipping stones
    Posts:11
    Avatar

    --
    09-01-2012 12:56 PM
    Okay I got it to fire by doing this:

    I added both functions to the custom javascript file and edited them:

    function validateInRange(str, min, max) {
      n = parseFloat(str);
      return(!isNaN(n) && n >= min && n <= max);
    }

    function validateFieldRange(DynamicName, min1, max1)
    {
      if(!validateInRange($(DynamicName), min1, max1)) {
        alert('Please enter a value between '+min1+' and '+max1);
        return false;
      }
    }


    And changed the clientside event code to be:

    validateFieldRange('Neck',10,20)

    But now it is always giving me the alert, even with a value of 11. And the alerts are popping up like crazy lol!

    Any suggestions?
    Brett LevertUser is Offline
    skipping stones
    skipping stones
    Posts:11
    Avatar

    --
    09-10-2012 04:25 PM
    Finally got it working with help from my developer!

    Client Side code for question:

    validateFieldRange($(Neck),10,20)

    Function in custom JavaScript area of the Module Configuration

     
    function validateInRange(str, min, max) {
        if(str == "")
        {
              return true;
        }
        else
        {
              n = parseFloat(str);
              return (!isNaN(n) && n >= min && n <= max);
        }
    }
    
    function validateFieldRange(DynamicForms, min1, max1) {
        if (!validateInRange(DynamicForms, min1, max1)) {
            alert('Please enter a value between ' + min1 + ' and ' + max1);
            
            return false;
        }
    }
    


    For anyone who is looking in the future!
    Chad NashUser is Offline
    Posts:5260
    Avatar

    --
    09-10-2012 05:03 PM
    Thanks so much for posting the update Brett!

    Thanks,

    Chad
    You are not authorized to post a reply.


     
     

    Join our mailing list...

    Get current news and events the easy way
    Subscribe Me

    Recent Blogs...

     
    Copyright 2005 - 2011 by Data Springs, Inc.
     
  • film izle
  • 720 izle
  • film
  • sinema izle
  • film makinesi
  • T�rk�e dublaj film
  • film izle
  • film izle
  • baglan film izle
  • sinema izle
  • 1080 film izle
  • film mercegi