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!

Trimming leading and trailing blanks
Last Post 03-15-2012 01:44 PM by Patrick Gaul. 5 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages Not Resolved
Patrick GaulUser is Offline
wading in the water
wading in the water
Posts:21
Avatar

--
03-12-2012 07:51 PM
    I'm looking for the best (and simplest) way to trim leading and trailing blank spaces from the value of a text string question, right after they have entered a value (tabbed off the field).

    I was thinking that a client side JavaScript like:

    $(LastName) = Trim($(LastName)); would do the trick... but that is not it.

    Any help appreciated!

    Thanks, Patrick
    Patrick GaulUser is Offline
    wading in the water
    wading in the water
    Posts:21
    Avatar

    --
    03-14-2012 05:43 PM
    Anybody? It would seem that this would be a very common action.
    Chad? Candace? Can't find anything about it in the documentation...
    LimnoUser is Offline
    skipping stones
    skipping stones
    Posts:5
    Avatar

    --
    03-15-2012 09:11 AM
    You need to add a trim function to the form's JavaScript section first and then use the simple syntax as you want:
    $(LastName) = trim($(LastName)); >>Advanced Field Options >>Client side event >>Put the above Javascript in the box for each Field. Case sensetive so use "trim" instead of "Trim"!
    You can put either trim function below to the Javascript section: >>Setup Module Configuration >>Advanced Coding Options (AJAX, jQuery, JavaScript, Initial SQL DataBind) >> Custom JavaScript File >> JavaScript File (Add the trim function within this section and click on Update Javascript File and then click on Update Settings function trim(stringToTrim) { return stringToTrim.replace(/^\s+|\s+$/g,""); } /* http://www.somacon.com/p355.php */ Or this one: function trim(s) { var l=0; var r=s.length -1; while(l < s.length && s[l] == ' ') { l++; } while(r > l && s[r] == ' ') { r-=1; } return s.substring(l, r+1); } /* http://doc.infosnel.nl/javascript_trim.html */
    Patrick GaulUser is Offline
    wading in the water
    wading in the water
    Posts:21
    Avatar

    --
    03-15-2012 11:53 AM
    Limno,

    Thanks for the excellent and detailed solution! I've tried both options, however, but still can't seem to make it work. I'm sure I'm missing something simple, but need to move my form forward to implementation. I will come back and try this later when I have more time.

    I really do, however, appreciate you taking the time to reply.

    - Patrick
    LimnoUser is Offline
    skipping stones
    skipping stones
    Posts:5
    Avatar

    --
    03-15-2012 01:29 PM

    You need to make sure to refresh your form page and check the HTML source to see both the trim function and clinet site code are both in place.

    I have tested on a DNN6.1.3 site and it works fine but I did need to do ctr-F5 a few times when I switched from these functions (update the javascript file). Good luck.

    Patrick GaulUser is Offline
    wading in the water
    wading in the water
    Posts:21
    Avatar

    --
    03-15-2012 01:44 PM
    Limno,

    I not sure if I have the correct expectation... once I had it set up, I entered a last name with several leading spaces, and tabbed off the control, and expected that the script would fire and the spaces would be trimmed. Is that what should happen?

    I'll follow your tips and try again.

    Thanks!

    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