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!

Add commas to numbers entered
Last Post 03-01-2011 01:12 PM by Ryan Bakerink. 10 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages Not Resolved
CherylUser is Offline
river guide
river guide
Posts:99
Avatar

--
01-10-2011 11:28 AM
    Is there a way to add commas into numbers that have been entered into a textbox field?
    CherylUser is Offline
    river guide
    river guide
    Posts:99
    Avatar

    --
    01-10-2011 11:57 AM
    Okay, I found that there is a Javascript function (addCommas) already in the Javascript file, but when enter that, with my field's shortname, in the client side event box under advanced field options, it doesn't seem to be doing anything.    Should it immediately add the commas once I go to another field?

    Also, assuming I could get this to work, is it possible to have two client side events on the same field?  (The fields that I want to format to have commas are also part of a total that is being summed.)

    Thanks to anyone who can help me!
    CherylUser is Offline
    river guide
    river guide
    Posts:99
    Avatar

    --
    01-12-2011 02:08 PM
    Is it that the function cannot be done to the field itself?  Meaning that I would have to be applying it to some other field and displaying that result?
    Ryan BakerinkUser is Offline
    river guide
    river guide
    Posts:1900
    Avatar

    --
    01-18-2011 02:03 PM
    Hello Cheryl,

    I would have one field collect the values separated by commas, and another separate field that collects these values, delimits them based on the comma, and then adds them together to get a summed total.

    So in essence, you should have one client side event that handles all of this.

    Thanks,

    Ryan


    CherylUser is Offline
    river guide
    river guide
    Posts:99
    Avatar

    --
    01-27-2011 09:55 AM
    Thanks, Ryan... that doesn't sound like it's addressing what I was trying to accomplish.  I'm not working with summing the values entered - I have already done that.  What I was wondering if I could do is reformat numbers after a user types them into a textbox.  So the user enters "10000" and once they click off to the next field, that would change to "10,000".  Can this be done?
    ChuckUser is Offline
    river guide
    river guide
    Posts:157
    Avatar

    --
    02-17-2011 11:55 AM
    Posted By Cheryl on 01-27-2011 11:55 AM
    Thanks, Ryan... that doesn't sound like it's addressing what I was trying to accomplish.  I'm not working with summing the values entered - I have already done that.  What I was wondering if I could do is reformat numbers after a user types them into a textbox.  So the user enters "10000" and once they click off to the next field, that would change to "10,000".  Can this be done?


    Did you get this resolved?  I was able to create a function that did this.  Im not exactly sure what your intention is for the result you are achieving because I have a caveat in using it.  If you are trying to do a calculation on it, it might bomb the sum total.  But hopefully you can figure out what you may need to do to fix it.

    Hope this helps. 
    -Chuck
    ======================================
    Here is my solution:
    Manage Questions | Advance Field Options | Client Side Event

    var cc = UnFormatNumber($(QuestionShortName_FieldID));
    $(QuestionShortName) = cc;

    Module Configuration | Custom Javascript File | Javascript File

    function UnFormatNumber(obj){

    var temp = document.getElementById(obj).value;

         if(temp == '') return (0);

         if(temp.length > 1 && temp.charAt(0) == '0') {
         //Remove leading 0
         var regex0 = /0/g;
         temp = temp.replace(regex0, '');
         }

         // Remove commas
         var regex1 = /,/gi;
         temp = temp.replace(regex1, '');

         // Add commas
         temp = addCommas(temp);

        return(temp);
    }
    Ryan BakerinkUser is Offline
    river guide
    river guide
    Posts:1900
    Avatar

    --
    02-18-2011 07:16 AM
    Hello Cheryl,

    I'm sorry that I lost track of this forum, please let me know if Chuck's JavaScript function helps you out??

    Thanks,

    Ryan
    CherylUser is Offline
    river guide
    river guide
    Posts:99
    Avatar

    --
    03-01-2011 07:48 AM
    The function that Chuck provided appears to be working great and does not mess up my totals. Thank you so much, Chuck!!!!!
    Ryan BakerinkUser is Offline
    river guide
    river guide
    Posts:1900
    Avatar

    --
    03-01-2011 08:39 AM
    Great job Chuck, thanks for your JavaScript function.

    -Ryan
    ChuckUser is Offline
    river guide
    river guide
    Posts:157
    Avatar

    --
    03-01-2011 10:19 AM
    Hi Cheryl and Ryan,
    Glad it works well.  I have changed my approach since using that solution.  I know formatting on the fly works well for the USER experience, but as I didnt know how it worked well when I had to use sum total calculations, I approached it differently to make it foolproof...at least I think I did.

    So what I did in another version is to allow the USER to enter the values either as an integer or decimal and the values would be formatted with commas and currency in  their respective hidden field (in my example, I am using text box, but change to hidden when ready).  This way if I have to supply the fields in the e-mail in a nice format, my hidden fields took care of it.

    I also, added some functionality where I can limit the USER to only add a set number of decimal values (in my case 2 places) and limit any unwanted characters.  These functions are to be credited from this link at:
    http://www.mredkj.com/tutorials/validate2.html

    It gives many options on how to limit a user on input whether its a currency, integer or a negative values...no unwanted characters are restricted which is nice.

    I also created a READ ONLY attribute script for my Total.

    If you dive into my example, you can see what I did.

    The link can be found at Datasprings BetaSprings site at:
    http://www.betasprings.com/Dynamic-...fault.aspx

    To access the example:
    User name:host
    Password:dnnhost

    Hope this options helps others too.

    -Chuck

    Note: I added onkeypress, onkeyup and onblur to the $(token) questions so Javascript events would be enabled.

    Ryan BakerinkUser is Offline
    river guide
    river guide
    Posts:1900
    Avatar

    --
    03-01-2011 01:12 PM
    Thanks again, for spending your valuable time to provide useful information for other.

    -Ryan
    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