Results 1 to 6 of 6
Like Tree1Likes
  • 1 Post By manishy@leosys.in

Thread: How to create a two dates validations in sugarcrm

  1. #1
    prince is offline Junior Member
    Join Date
    Sep 2007
    Posts
    110

    Default How to create a two dates validations in sugarcrm

    How to create a two dates validations comparision in sugarcrm

  2. #2
    manishy@leosys.in Guest

    Smile Re: How to create a two dates validations in sugarcrm

    Quote Originally Posted by prince View Post
    How to create a two dates validations comparision in sugarcrm
    Hi,
    You have to do some customization for it,
    Ex:If opportunities have two dates,then create customjs.js in modules and include it in editviewdefs.php.Then in js file you have to call to addtovalidate() function ,pass appropriate parameter to it.In that function,write yourCustomFunction()name and then in include/javascript/sugar_grp1.js file,create one case under switch same as Int case.then write ur custom function and then write function definition in same file and return true or false as per your condition.
    Thanks,
    Manish
    prince likes this.

  3. #3
    prince is offline Junior Member
    Join Date
    Sep 2007
    Posts
    110

    Default Re: How to create a two dates validations in sugarcrm

    Quote Originally Posted by manishy@leosys.in View Post
    Hi,
    You have to do some customization for it,
    Ex:If opportunities have two dates,then create customjs.js in modules and include it in editviewdefs.php.Then in js file you have to call to addtovalidate() function ,pass appropriate parameter to it.In that function,write yourCustomFunction()name and then in include/javascript/sugar_grp1.js file,create one case under switch same as Int case.then write ur custom function and then write function definition in same file and return true or false as per your condition.
    Thanks,
    Manish


    Dear manishy@leosys.in ,
    Could you please post the detail code because of i am new to sugarcrm

  4. #4
    prince is offline Junior Member
    Join Date
    Sep 2007
    Posts
    110

    Default Re: How to create a two dates validations in sugarcrm

    Quote Originally Posted by prince View Post
    How to create a two dates validations comparision in sugarcrm
    Please post a sugarcrm upload file document datatype.How to create this records

  5. #5
    manishy@leosys.in Guest

    Default Re: How to create a two dates validations in sugarcrm

    Hi,
    You have to create first js file under modules and include that js file in editviewdefs.php file of module.Then in js file you have to call adddtovalidate function as stated below..
    addToValidate('EditView', 'date_start', 'customCase', false,'Please enter valid Start Date' );
    Then write custom case as 'customCase' as below in include/javascript/sugar_grp1.js..

    case'customCase':if(!isCustomFunc(trim(form[validate[formname][i][nameIndex]].value))){isError=true;add_error_style(formname,va lidate[formname][i][nameIndex],invalidTxt+" "+validate[formname][i][msgIndex]);}break;


    Then write definition for iscustomFunc() in same include/javascript/sugar_grp1.js file as below...
    function isCustomFunc()
    {
    //write your custom code here...
    get your start and end date using js syntax and then compare it as you required and return true/false as your condition.
    }

    Hope it help you....

    Thanks,
    Manish

  6. #6
    davidboris's Avatar
    davidboris is offline Sugar Community Member
    Join Date
    May 2010
    Posts
    1,525

    Default Re: How to create a two dates validations in sugarcrm

    Hello Prince,

    If you want to compare two date like start_date and end_date. You can do it via vardefs.
    Have a look into example modules/Project/vardefs.php.

    PHP Code:
    'validation' => array('type' => 'isbefore''compareto' => 'estimated_end_date''blank' => true), 
    Web : http://www.urdhva-tech.com
    Twitter : @urdhvatech
    Email : contact@urdhva-tech.com
    Blog : Urdhva-Tech
    Skype : urdhvatech

    Our Premium Projects for SugarCRM:
    Premium theme for SugarCRM CE (Community Edition 6.5+ with 4 combinations, Black + Orange/Red/Green/Blue, bootstrap3 based)
    Duplicate detector to avoid duplicate data entry.
    Customer Self Service Portal for All Flavours.
    tagMe A complete tag management for SugarCRM.
    Meeting Map Reminder Meeting reminder with Gmap in Email

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 2009-01-22, 05:58 PM
  2. Validations in sugarcrm 5.1
    By reddysankarsugarcrm in forum Help
    Replies: 2
    Last Post: 2009-01-07, 02:37 PM
  3. validations in sugarcrm
    By bathi741 in forum Developer Help
    Replies: 7
    Last Post: 2008-09-29, 11:53 AM
  4. validations in sugarcrm
    By bathi741 in forum General Discussion
    Replies: 5
    Last Post: 2008-04-17, 11:34 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
  •