Results 1 to 2 of 2

Thread: Blank required fields still saving

  1. #1
    eggsurplus's Avatar
    eggsurplus is offline Sugar Community Member
    Join Date
    Dec 2005
    Location
    Minnesota
    Posts
    2,858

    Question Blank required fields still saving

    I posted this over in the Downloads since there is a string going there already but I may have more luck in the Help section. The custom module is in the zip at the bottom of that thread. Thanks for the help!

    Can someone tell me why I can save a queue without entering the required fields? I've got the vardefs.php set for required:

    PHP Code:
    'name' => array( 
                
    'name' => 'name'
                
    'vname' => 'LBL_NAME'
                
    'required' => true
                
    'type' => 'varchar'
                
    'len' => 150
                
    'massupdate' => 'false'
            ), 
            
    'order_num' => array ( 
                
    'name' => 'order_num'
                
    'vname' => 'LBL_ORDER_NUM'
                
    'type' => 'int'
                
    'required'=>'true'
                
    'massupdate' => 'false'
              ), 

    The EditView.html save button has an onlick="this.form.action.value='Save';return check_form('EditView');" and the required fields each have: <span class="required">{APP.LBL_REQUIRED_SYMBOL}</span>.

    Queues.php has var $required_fields = array('name'=>1,'order_num'=>2); I did try commenting that and the columns out and adding a field_arrays.php to the module folder but had no luck that way either.

    Any help would be greatly appreciated! (Sorry Olavo, these files don't have your additions in them yet. It does have a very simple rule system implemented now though.)

  2. #2
    eggsurplus's Avatar
    eggsurplus is offline Sugar Community Member
    Join Date
    Dec 2005
    Location
    Minnesota
    Posts
    2,858

    Lightbulb Re: Blank required fields still saving

    Figured it out. At the end of EditView.html make sure the {JAVASCRIPT} tag is there and in the EditView.php file add at the very bottom:

    PHP Code:
    require_once('include/javascript/javascript.php');
    $javascript = new javascript();
    $javascript->setFormName('EditView');
    $javascript->setSugarBean($focus);
    $javascript->addAllFields('');
    echo 
    $javascript->getScript(); 
    After outputting to the main area: $xtpl->out("main");

    Now it validates as it should. Hope that helps.

Thread Information

Users Browsing this Thread

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

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
  •