Results 1 to 6 of 6

Thread: Sanitizing Numbers?

  1. #1
    mhoppes is offline Sugar Community Member
    Join Date
    May 2007
    Posts
    45

    Default Sanitizing Numbers?

    When someone enters a number in Sugar they might try to put it in like (215) 011-9343 or like 215-011-9343 or like (215)-011-9343 or like something else I can't even think of off hand. Is there any way to get Sugar to sanitize the phone number fields and either correct them, or make sure they are in one format or another?

  2. #2
    SamuelAugy is offline Sugar Community Member
    Join Date
    Sep 2007
    Location
    Paris (France)
    Posts
    238

    Default Re: Sanitizing Numbers?

    You have two choice :
    1. Add a javascript function in the EditView.php of your module that you call on the save button in the EditView.html. This function have to be inside
      Code:
      echo <<<EOQ
      and
      Code:
      EOQ;
      .
    2. Add controls in the handleSave function in the xxxxxFormBase.php file


    Samuel Augy
    Ysance

  3. #3
    mhoppes is offline Sugar Community Member
    Join Date
    May 2007
    Posts
    45

    Default Re: Sanitizing Numbers?

    Ok.. but is that upgrade safe? Won't that be erased when an upgrade is done?

  4. #4
    Angel's Avatar
    Angel is offline Sugar Community Member
    Join Date
    Jul 2005
    Location
    Los Angeles
    Posts
    4,813

    Default Re: Sanitizing Numbers?

    You could also use a logic hook to sanitize the number for you before it is committed to the database.

    Check out the Wiki for further info on logic hooks: http://www.sugarcrm.com/wiki

    The hook would be upgrade safe, but you wouldn't see the result till the record is saved, whereas through javascript, you could do it on the fly. There is an older thread where I posted some code that will do that and others added to it. Searching the forum for "phone formatting" should yield that thread.
    Regards,

    Angel Magaņa
    Co-Author: Implementing SugarCRM 5.x (Packt Publishing -- Sept. 2010)
    Blog: http://cheleguanaco.blogspot.com.
    Twitter: @cheleguanaco.

    ________
    | Projects: |_____________________________________
    |
    | CandyWrapper (.NET Wrapper for SugarCRM SOAP API). Source now available on GitHub!
    | GoldMine to SugarCRM Express Conversion. Latest: 1.0.1.7 (Nov. 3, 2009)
    | CRM SkyDialer (Skype Integration). Latest: 1.0.2 (Feb. 17, 2010)
    | Round Robin Leads Assignment
    | Phone Number Formatter
    | CaseTwit (Twitter Integration)
    ______________________________________________

  5. #5
    mhoppes is offline Sugar Community Member
    Join Date
    May 2007
    Posts
    45

    Default Re: Sanitizing Numbers?

    Quote Originally Posted by Angel
    You could also use a logic hook to sanitize the number for you before it is committed to the database.

    Check out the Wiki for further info on logic hooks: http://www.sugarcrm.com/wiki

    The hook would be upgrade safe, but you wouldn't see the result till the record is saved, whereas through javascript, you could do it on the fly. There is an older thread where I posted some code that will do that and others added to it. Searching the forum for "phone formatting" should yield that thread.
    A logic hook may be the only way to go.. looked at your code.. looks good. but doesn't look upgrade-safe.

  6. #6
    Angel's Avatar
    Angel is offline Sugar Community Member
    Join Date
    Jul 2005
    Location
    Los Angeles
    Posts
    4,813

    Default Re: Sanitizing Numbers?

    Yes, that's correct, any javascript approach would not be upgrade safe.
    Regards,

    Angel Magaņa
    Co-Author: Implementing SugarCRM 5.x (Packt Publishing -- Sept. 2010)
    Blog: http://cheleguanaco.blogspot.com.
    Twitter: @cheleguanaco.

    ________
    | Projects: |_____________________________________
    |
    | CandyWrapper (.NET Wrapper for SugarCRM SOAP API). Source now available on GitHub!
    | GoldMine to SugarCRM Express Conversion. Latest: 1.0.1.7 (Nov. 3, 2009)
    | CRM SkyDialer (Skype Integration). Latest: 1.0.2 (Feb. 17, 2010)
    | Round Robin Leads Assignment
    | Phone Number Formatter
    | CaseTwit (Twitter Integration)
    ______________________________________________

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Fax numbers not showing
    By Fenris in forum Help
    Replies: 3
    Last Post: 2008-03-27, 12:30 AM
  2. Replies: 13
    Last Post: 2006-09-25, 04:46 PM
  3. Autofill Phone Numbers
    By kbrill in forum Developer Help
    Replies: 1
    Last Post: 2005-11-17, 02:15 AM

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
  •