Alpha Video Training
Results 1 to 5 of 5

Thread: Prevent the first value in a text field from being a blank space

  1. #1
    Member
    Real Name
    Joe
    Join Date
    Mar 2009
    Location
    NY
    Posts
    507

    Default Prevent the first value in a text field from being a blank space

    Hi All...

    Been searching around and I'm trying to figure out how to do this...

    I have UX that users enter Insured information in (Company Name, Address, City, State, etc.). For the Company Name users either copy and paste it from somewhere or type it in. When they do so they sometimes put a blank space in as the first character.

    Ex. " My Company Name" instead of "My Company Name"

    This cause problems as the value that is entered gets used on the systems that read from the database that is used for the Alpha application. That space causes all sorts of problems from filing documents automatically to generating policy documents.

    Is their a way to prevent or scrub that blank space before the user submits the UX?

    Thanks
    Joe
    Never take a ride to the edge of your mind unless you've got a ticket back - Jon Oliva - Savatage.

  2. #2
    "Certified" Alphaholic mikeallenbrown's Avatar
    Real Name
    Mike Brown
    Join Date
    Nov 2009
    Location
    United States
    Posts
    1,879

    Default Re: Prevent the first value in a text field from being a blank space

    Try this JS in the onBlur client-side event...

    Code:
    var companyName = {dialog.object}.getValue('CompanyName');
    
    {dialog.object}.setValue('CompanyName',companyName.trim());
    Should trim both the leading and trailing spaces. The code executes when the user leaves (tabs off or clicks some other control) the company field.
    Mike Brown - Contact Me
    Programmatic Technologies, LLC
    Programmatic-Technologies.com
    Independent Developer & Consultant

  3. #3
    Member
    Real Name
    Joe
    Join Date
    Mar 2009
    Location
    NY
    Posts
    507

    Default Re: Prevent the first value in a text field from being a blank space

    Awesome...thank you!!! I can see me using that everywhere that that is occurring.
    Never take a ride to the edge of your mind unless you've got a ticket back - Jon Oliva - Savatage.

  4. #4
    "Certified" Alphaholic
    Real Name
    Larry Grupido
    Join Date
    May 2010
    Posts
    1,820

    Default Re: Prevent the first value in a text field from being a blank space

    If this is a SQL database, you could also write similar code into a trigger statement. That way it would be active for every save/edit on every form and you could write all the code in one place.

  5. #5
    "Certified" Alphaholic TheSmitchell's Avatar
    Real Name
    Sarah
    Join Date
    Apr 2012
    Posts
    1,334

    Default Re: Prevent the first value in a text field from being a blank space

    Quote Originally Posted by cavj1 View Post
    Hi All...

    Been searching around and I'm trying to figure out how to do this...

    I have UX that users enter Insured information in (Company Name, Address, City, State, etc.). For the Company Name users either copy and paste it from somewhere or type it in. When they do so they sometimes put a blank space in as the first character.

    Ex. " My Company Name" instead of "My Company Name"

    This cause problems as the value that is entered gets used on the systems that read from the database that is used for the Alpha application. That space causes all sorts of problems from filing documents automatically to generating policy documents.

    Is their a way to prevent or scrub that blank space before the user submits the UX?

    Thanks
    Joe
    Hello Joe,

    The Client Side Propertes > Client side formatting can be used to strip out those spaces.

    Enable the "Client side formatting" property and specify the Format type is "Custom". Then, add this to the format definition:

    Code:
    data = $u.s.aTrim(data)
    That should do what you want without needing to add anything to the client-side events. Bonus: Works if you set the value programmatically; onBlur does not execute if you set the value with code.

    formatRemoveSpaces.png
    Alpha Anywhere latest pre-release

Similar Threads

  1. How to unTrim Blank Space into SQL field
    By FaisalY in forum Application Server Version 11 - Web/Browser Applications
    Replies: 11
    Last Post: 02-18-2014, 07:40 AM
  2. Can't Remove Blank Space between "Above Search Part" text and actual search Grid
    By kimhere in forum Application Server Version 11 - Web/Browser Applications
    Replies: 3
    Last Post: 03-17-2013, 12:17 PM
  3. Get rid of white space for Static Text if Show/Hide expression hides the text
    By kingcarol in forum Application Server Version 11 - Web/Browser Applications
    Replies: 5
    Last Post: 04-04-2012, 10:24 AM
  4. Double Space Rich Text Field
    By nuggetsoftware in forum Alpha Five Version 10 - Desktop Applications
    Replies: 2
    Last Post: 10-13-2010, 12:37 PM
  5. replace blank report field with text
    By Camille Venners in forum Alpha Five Version 5
    Replies: 5
    Last Post: 06-23-2003, 02:52 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •