Results 1 to 3 of 3

Thread: Custom Field Validation

  1. #1
    crmqwerty is offline Member
    Join Date
    May 2008
    Posts
    9

    Default Custom Field Validation

    hi

    i create user_name and password (custome field) in account form sugar
    crm .Now i face a problem i need this username and password unique,if
    any body created sername and pasword earlier then alert already exist
    msg.How can i validate form.
    help me plz..

  2. #2
    eNick is offline Sugar Community Member
    Join Date
    Apr 2008
    Location
    UK
    Posts
    282

    Default Re: Custom Field Validation

    The method will depend, somewhat, on whether you wish to use the normal Javascript validation routines. If it is critical, with something like passwords, I'd be inclined to validate both in Javascript and in PHP.

    From Javascript, I'd probably use an Ajax call to call the server and run a database query to see if the username and password is ok. Otherwise, for vanilla javascript, you're going to have to transport every username and password to the client screen so it can be checked.

    For backend validation, it's much easier... code up a custom hook on the before_save event. In the hook, call a routine which queries the database. If no match found, you're good to continue. If a match is found, I'd save the bean in the current user's session and redirect back to the edit page.

    You'd then need a second hook which triggers on retrieval of the bean, so that you can check if there is a previous edited bean in the user's session. That way, you can update the values before display (or just swap the bean) so the user doesn't lose everything they've typed in.
    T H E S U G A R R E F I N E R Y
    : : : SugarCrm Customisation and Integration Services : : :

    SugarCRM Systems Integration Partner
    Trusted with SugarCRM
    http://www.theSugarRefinery.com ::: sales@{removethis}theSugarRefinery.com

  3. #3
    cptmac is offline Member
    Join Date
    Apr 2011
    Posts
    9

    Default Re: Custom Field Validation

    eNick,

    I am new to sugar and I have the logic hook coded to run a query on the DB for what I am trying to validate.

    Can you elaborate on the following process (or refer me to a link I can read)?

    1. Save the bean in current user session and redirect back to the edit page
    2. 2nd Hook for bean read to check for session bean to not lose typed in values. (not sure which hook to implement here)

    Thanks in advance,

    Mac

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. upgraded to 4.5.1e, received "Metadata for table tracker does not exist"
    By sfgeorge in forum Installation and Upgrade Help
    Replies: 0
    Last Post: 2007-09-03, 02:24 PM
  2. Custom Field add not visible is Edit Layout
    By tylerpoint in forum Help
    Replies: 0
    Last Post: 2007-07-09, 05:56 AM
  3. Asterisk Patch 1.1.0 Crash on logon
    By skyracer in forum Help
    Replies: 6
    Last Post: 2006-07-08, 06:30 AM
  4. Replies: 7
    Last Post: 2006-06-06, 07:56 PM
  5. Custom Field Validation after 4.xx upgrade
    By jrobgood in forum Help
    Replies: 1
    Last Post: 2006-05-05, 08:33 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
  •