fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [13023] client side form validation


From: Sigurd Nes
Subject: [Fmsystem-commits] [13023] client side form validation
Date: Thu, 16 Apr 2015 11:21:20 +0000

Revision: 13023
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=13023
Author:   sigurdne
Date:     2015-04-16 11:21:19 +0000 (Thu, 16 Apr 2015)
Log Message:
-----------
client side form validation

Modified Paths:
--------------
    branches/dev-syncromind/phpgwapi/inc/class.categories.inc.php
    branches/dev-syncromind/phpgwapi/templates/base/categories.xsl
    branches/dev-syncromind/property/inc/class.bocommon.inc.php
    branches/dev-syncromind/property/inc/class.uibudget.inc.php
    branches/dev-syncromind/property/inc/class.uicondition_survey.inc.php
    branches/dev-syncromind/property/inc/class.uiproject.inc.php
    branches/dev-syncromind/property/inc/class.uirequest.inc.php
    branches/dev-syncromind/property/inc/class.uitts.inc.php
    branches/dev-syncromind/property/inc/class.uiworkorder.inc.php
    branches/dev-syncromind/property/js/portico/tts.add.js
    branches/dev-syncromind/property/js/portico/tts.view.js
    branches/dev-syncromind/property/js/portico/workorder.edit.js
    branches/dev-syncromind/property/templates/base/condition_survey.xsl
    branches/dev-syncromind/property/templates/base/location_form.xsl
    branches/dev-syncromind/property/templates/base/location_form2.xsl
    branches/dev-syncromind/property/templates/base/status_select.xsl
    branches/dev-syncromind/property/templates/base/tts.xsl
    branches/dev-syncromind/property/templates/base/workorder.xsl
    branches/dev-syncromind/property/templates/pure/b_account_form.xsl
    branches/dev-syncromind/property/templates/pure/ecodimb_form.xsl
    branches/dev-syncromind/property/templates/pure/vendor_form.xsl

Modified: branches/dev-syncromind/phpgwapi/inc/class.categories.inc.php
===================================================================
--- branches/dev-syncromind/phpgwapi/inc/class.categories.inc.php       
2015-04-16 07:23:43 UTC (rev 13022)
+++ branches/dev-syncromind/phpgwapi/inc/class.categories.inc.php       
2015-04-16 11:21:19 UTC (rev 13023)
@@ -654,6 +654,8 @@
                                $select_name    = isset($data['select_name']) 
&& $data['select_name'] ? $data['select_name'] : 'cat_id';
                                $use_acl                = 
isset($data['use_acl']) ? $data['use_acl'] : '';
                                $class                  = isset($data['class']) 
&& $data['class'] ? $data['class'] : 'forms';
+                               $required               = 
isset($data['required']) && $data['required'] ? true : false;
+                               $disabled               = 
isset($data['disabled']) && $data['disabled'] ? true : false;
                        }
                        else
                        {
@@ -729,7 +731,9 @@
                                'select_url'                    => 
$GLOBALS['phpgw']->link('/index.php', $link_data),
                                'select_name'                   => $select_name,
                                'lang_submit'                   => 
lang('submit'),
-                               'class'                         => $class
+                               'class'                                 => 
$class,
+                               'required'                              => 
$required,
+                               'disabled'                              => 
$disabled
                        );
                        return $cat_data;
                }

Modified: branches/dev-syncromind/phpgwapi/templates/base/categories.xsl
===================================================================
--- branches/dev-syncromind/phpgwapi/templates/base/categories.xsl      
2015-04-16 07:23:43 UTC (rev 13022)
+++ branches/dev-syncromind/phpgwapi/templates/base/categories.xsl      
2015-04-16 11:21:19 UTC (rev 13023)
@@ -30,15 +30,23 @@
                </form>
        </xsl:template>
 
-       <xsl:template match="cat_select">
+       <xsl:template match="cat_select" xmlns:php="http://php.net/xsl";>
        <xsl:variable name="lang_cat_statustext"><xsl:value-of 
select="lang_cat_statustext"/></xsl:variable>
        <xsl:variable name="select_name"><xsl:value-of 
select="select_name"/></xsl:variable>
-               <select id = "global_category_id" name="{$select_name}" 
class="{class}" title="{$lang_cat_statustext}" data-validation="required" 
data-validation-error-msg="Please select a category !">
+               <select id = "global_category_id" name="{$select_name}" 
class="{class}" title="{$lang_cat_statustext}">
                                <xsl:if test="disabled = 1">
                                        <xsl:attribute name="disabled">
                                                <xsl:text>disabled</xsl:text>
                                        </xsl:attribute>
                                </xsl:if>
+                               <xsl:if test="required = 1">
+                                       <xsl:attribute name="data-validation">
+                                               <xsl:text>required</xsl:text>
+                                       </xsl:attribute>
+                                       <xsl:attribute 
name="data-validation-error-msg">
+                                               <xsl:value-of 
select="php:function('lang', 'Please select a category !')"/>
+                                       </xsl:attribute>
+                               </xsl:if>
                        <option value=""><xsl:value-of 
select="lang_no_cat"/></option>
                                <xsl:apply-templates select="cat_list"/>
                </select>

Modified: branches/dev-syncromind/property/inc/class.bocommon.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.bocommon.inc.php 2015-04-16 
07:23:43 UTC (rev 13022)
+++ branches/dev-syncromind/property/inc/class.bocommon.inc.php 2015-04-16 
11:21:19 UTC (rev 13023)
@@ -576,6 +576,7 @@
                        $vendor['lang_vendor']                  = 
lang('Vendor');
                        $vendor['lang_select_vendor_help']      = lang('click 
this link to select vendor');
                        $vendor['lang_vendor_name']             = lang('Vendor 
Name');
+                       $vendor['required']                             = 
isset($data['required']) && $data['required'] ? true : false;
                        //_debug_array($vendor);
                        return $vendor;
                }
@@ -720,6 +721,7 @@
                        }
 
                        $b_account['disabled']                          = 
isset($data['disabled']) && $data['disabled'] ? true : false;
+                       $b_account['required']                          = 
isset($data['required']) && $data['required'] ? true : false;
                        return $b_account;
                }
 
@@ -788,6 +790,7 @@
                                $ecodimb['value_ecodimb_descr'] = 
$ecodimb_data['descr'];
                        }
                        $ecodimb['disabled']                            = 
isset($data['disabled']) && $data['disabled'] ? true : false;
+                       $ecodimb['required']                            = 
isset($data['required']) && $data['required'] ? true : false;
 
                        return $ecodimb;
                }

Modified: branches/dev-syncromind/property/inc/class.uibudget.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.uibudget.inc.php 2015-04-16 
07:23:43 UTC (rev 13022)
+++ branches/dev-syncromind/property/inc/class.uibudget.inc.php 2015-04-16 
11:21:19 UTC (rev 13023)
@@ -979,7 +979,9 @@
                        
$b_account_data=$this->bocommon->initiate_ui_budget_account_lookup(array(
                                'b_account_id'          => 
$values['b_account_id'],
                                'b_account_name'        => 
isset($values['b_account_name'])?$values['b_account_name']:'',
-                               'type'                  => 
isset($values['b_account_id']) && $values['b_account_id'] > 0 ?'view':'form'));
+                               'type'                  => 
isset($values['b_account_id']) && $values['b_account_id'] > 0 ?'view':'form',
+                               'required'              => true
+                               ));
 
                        
$ecodimb_data=$this->bocommon->initiate_ecodimb_lookup(array(
                                'ecodimb'                       => 
$values['ecodimb'],

Modified: branches/dev-syncromind/property/inc/class.uicondition_survey.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.uicondition_survey.inc.php       
2015-04-16 07:23:43 UTC (rev 13022)
+++ branches/dev-syncromind/property/inc/class.uicondition_survey.inc.php       
2015-04-16 11:21:19 UTC (rev 13023)
@@ -515,8 +515,7 @@
                                'status_list'                                   
=> array('options' => execMethod('property.bogeneric.get_list',array('type' => 
'condition_survey_status', 'selected' => $values['status_id'], 'add_empty' => 
true))),
                                'editable'                                      
        => $mode == 'edit',
                                'tabs'                                          
        => phpgwapi_jquery::tabview_generate($tabs, $active_tab),
-                               'multiple_uploader'                             
=> $mode == 'edit' ? true : '',
-                'validator'                     => 
phpgwapi_jquery::formvalidator_generate(array('location', 'date', 'security', 
'file')) 
+                               'multiple_uploader'                             
=> $mode == 'edit' ? true : ''
                        );
                        
                        //print_r($data['tabs']); die;
@@ -528,9 +527,7 @@
                                
$GLOBALS['phpgw']->jqcal->add_listener('report_date');
                                phpgwapi_jquery::load_widget('core');
                                self::add_javascript('property', 'portico', 
'condition_survey_edit.js');
-                               //self::add_javascript('phpgwapi', 'yui3', 
'yui/yui-min.js');
-                               //self::add_javascript('phpgwapi', 
'yui3-gallery', 'gallery-formvalidator/gallery-formvalidator-min.js');
-                               
//$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yui3-gallery/gallery-formvalidator/validatorCss.css');
+                phpgwapi_jquery::formvalidator_generate(array('location', 
'date', 'security', 'file'));
                        }
 
                        self::add_javascript('property', 'portico', 
'condition_survey.js');

Modified: branches/dev-syncromind/property/inc/class.uiproject.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.uiproject.inc.php        
2015-04-16 07:23:43 UTC (rev 13022)
+++ branches/dev-syncromind/property/inc/class.uiproject.inc.php        
2015-04-16 11:21:19 UTC (rev 13023)
@@ -1402,7 +1402,8 @@
                                        'tenant'        => true,
                                        'lookup_type'   => $lookup_type,
                                        'lookup_entity' => 
$this->bocommon->get_lookup_entity('project'),
-                                       'entity_data'   => 
(isset($values['p'])?$values['p']:'')
+                                       'entity_data'   => 
(isset($values['p'])?$values['p']:''),
+                                       'required_level' => 1
                                )
                        );
 
@@ -1975,7 +1976,6 @@
                                        'origin_id'             => $id
                                );
                        }
-                       
                        $msgbox_data = 
$this->bocommon->msgbox_data($this->receipt);
 
                        $project_type_id = isset($values['project_type_id']) && 
$values['project_type_id'] ? $values['project_type_id'] : 
$GLOBALS['phpgw_info']['user']['preferences']['property']['default_project_type'];
@@ -2068,7 +2068,7 @@
                                        'lang_save_statustext'                  
        => lang('Save the project'),
                                        'lang_no_cat'                           
                => lang('Select category'),
                                        'value_cat_id'                          
                => isset($values['cat_id'])?$values['cat_id']:'',
-                                       'cat_select'                            
                => $this->cats->formatted_xslt_list(array('select_name' => 
'values[cat_id]','selected' => $values['cat_id'])),
+                                       'cat_select'                            
                => $this->cats->formatted_xslt_list(array('select_name' => 
'values[cat_id]','selected' => $values['cat_id'],'required' => 
isset($config->config_data['project_optional_category']) && 
$config->config_data['project_optional_category'] ? false : true)),
                                        'lang_workorder_id'                     
                => lang('Workorder ID'),
                                        'lang_sum'                              
                        => lang('Sum'),
                                        'value_remainder'                       
                => $value_remainder,
@@ -2080,6 +2080,7 @@
                                        'user_list'                             
                        => 
$this->bocommon->get_user_list_right2('select',4,$values['coordinator'],$this->acl_location),
                                        'status_list'                           
                => $this->bo->select_status_list('select',$values['status']),
                                        'status_name'                           
                => 'values[status]',
+                                       'status_required'                       
                => true,
                                        'lang_no_status'                        
                => lang('Select status'),
                                        'lang_status'                           
                => lang('Status'),
                                        'lang_status_statustext'                
        => lang('What is the current status of this project ?'),
@@ -2593,6 +2594,9 @@
                        $this->edit(array(), $mode = 'view');
                }
 
+               /**
+                * Not used?
+                */
                function project_group()
                {
                        $id     = phpgw::get_var('id');

Modified: branches/dev-syncromind/property/inc/class.uirequest.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.uirequest.inc.php        
2015-04-16 07:23:43 UTC (rev 13022)
+++ branches/dev-syncromind/property/inc/class.uirequest.inc.php        
2015-04-16 11:21:19 UTC (rev 13023)
@@ -1534,7 +1534,7 @@
                                        'lang_cat_statustext'                   
        => lang('Select the category the request belongs to. To do not use a 
category select NO CATEGORY'),
                                        'value_cat_id'                          
                => $values['cat_id'],
 
-                                       'cat_select'                            
                => $this->cats->formatted_xslt_list(array('select_name' => 
'values[cat_id]','selected' => $values['cat_id'], 'class' => 'required')),
+                                       'cat_select'                            
                => $this->cats->formatted_xslt_list(array('select_name' => 
'values[cat_id]','selected' => $values['cat_id'], 'class' => 
'required','required' =>true)),
 
                                        'lang_coordinator'                      
                => 
isset($this->config->config_data['lang_request_coordinator']) && 
$this->config->config_data['lang_request_coordinator'] ? 
$this->config->config_data['lang_request_coordinator'] : lang('request 
coordinator'),
 

Modified: branches/dev-syncromind/property/inc/class.uitts.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.uitts.inc.php    2015-04-16 
07:23:43 UTC (rev 13022)
+++ branches/dev-syncromind/property/inc/class.uitts.inc.php    2015-04-16 
11:21:19 UTC (rev 13023)
@@ -1326,7 +1326,7 @@
                                        'lang_town_statustext'                  
=> lang('Select the part of town the building belongs to. To do not use a part 
of town -  select NO PART OF TOWN'),
                                        'lang_part_of_town'                     
        => lang('Part of town'),
                                        'lang_no_part_of_town'                  
=> lang('No part of town'),
-                                       'cat_select'                            
        => $this->cats->formatted_xslt_list(array('select_name' => 
'values[cat_id]','selected' => $this->cat_id,'use_acl' => 
$this->_category_acl)),
+                                       'cat_select'                            
        => $this->cats->formatted_xslt_list(array('select_name' => 
'values[cat_id]','selected' => $this->cat_id,'use_acl' => 
$this->_category_acl,'required' => true)),
                                        'pref_send_mail'                        
        => 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['tts_user_mailnotification'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['tts_user_mailnotification']:''),
                                        'fileupload'                            
        => 
(isset($this->bo->config->config_data['fmttsfileupload'])?$this->bo->config->config_data['fmttsfileupload']:''),
                                );
@@ -1336,7 +1336,7 @@
                        $function_msg                                   = 
lang('add ticket');
 
                        self::add_javascript('property', 'portico', 
'tts.add.js');
-
+                       
phpgwapi_jquery::formvalidator_generate(array('location', 'date', 'security', 
'file'));
                        $this->_insert_custom_js();
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('tts','files','attributes_form'));
@@ -2351,7 +2351,7 @@
                        
//----------------------------------------------datatable settings--------      
                
 //_debug_array($supervisor_email);die();
                        $msgbox_data = $this->bocommon->msgbox_data($receipt);
-                       $cat_select     = 
$this->cats->formatted_xslt_list(array('select_name' => 
'values[cat_id]','selected' => $this->cat_id,'use_acl' => 
$this->_category_acl));
+                       $cat_select     = 
$this->cats->formatted_xslt_list(array('select_name' => 
'values[cat_id]','selected' => $this->cat_id,'use_acl' => 
$this->_category_acl,'required' => true));
                        
                        $_ticket_cat_found = false;
                        if(isset($cat_select['cat_list']) && 
is_array($cat_select['cat_list']))
@@ -2385,8 +2385,8 @@
                        }
 
 
-                       $this->cats->set_appname('property','.project');
-                       $order_catetory = 
$this->cats->formatted_xslt_list(array('select_name' => 
'values[cat_id]','selected' => $ticket['order_cat_id']));
+//                     $this->cats->set_appname('property','.project');
+//                     $order_catetory = 
$this->cats->formatted_xslt_list(array('select_name' => 
'values[order_cat_id]','selected' => $ticket['order_cat_id']));
 
                        $year   = date('Y') -1;
                        $limit  = $year + 3;
@@ -2408,6 +2408,8 @@
                                $my_groups[$group_id] = $group->firstname;
                        }
 
+                       
phpgwapi_jquery::formvalidator_generate(array('location', 'date', 'security', 
'file'));
+
                        $data = array
                        (
                                        'datatable_def'                         
        => $datatable_def,
@@ -2515,7 +2517,7 @@
                                        'lang_file_statustext'                  
=> lang('Select file to upload'),
                                        'textareacols'                          
        => 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] : 60,
                                        'textarearows'                          
        => 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] : 6,
-                                       'order_cat_list'                        
        => $order_catetory,
+//                                     'order_cat_list'                        
        => $order_catetory,
                                        'building_part_list'                    
=> array('options' => $this->bocommon->select_category_list(array('type'=> 
'building_part','selected' =>$ticket['building_part'], 'order' => 'id', 
'id_in_name' => 'num', 'filter' => $_filter_buildingpart))),
                                        'order_dim1_list'                       
        => array('options' => 
$this->bocommon->select_category_list(array('type'=> 'order_dim1','selected' 
=>$ticket['order_dim1'], 'order' => 'id', 'id_in_name' => 'num' ))),
                                        'branch_list'                           
        => 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['tts_branch_list'])
 && 
$GLOBALS['phpgw_info']['user']['preferences']['property']['tts_branch_list']==1 
? array('options' => execMethod('property.boproject.select_branch_list', 
$values['branch_id'])) :'',

Modified: branches/dev-syncromind/property/inc/class.uiworkorder.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.uiworkorder.inc.php      
2015-04-16 07:23:43 UTC (rev 13022)
+++ branches/dev-syncromind/property/inc/class.uiworkorder.inc.php      
2015-04-16 11:21:19 UTC (rev 13023)
@@ -1339,7 +1339,9 @@
                        $vendor_data = 
$this->bocommon->initiate_ui_vendorlookup(array(
                                'vendor_id'             => $values['vendor_id'],
                                'vendor_name'   => $values['vendor_name'],
-                               'type'                  => $mode));
+                               'type'                  => $mode,
+                               'required'              => 
isset($config->config_data['workorder_require_vendor']) && 
$config->config_data['workorder_require_vendor'] == 1
+                       ));
 
 
                        $b_group_data = 
$this->bocommon->initiate_ui_budget_account_lookup(array(
@@ -1352,7 +1354,9 @@
                                'b_account_name'        => 
$values['b_account_name'],
                                'disabled'                      => '',
                                'parent'                        => 
$project['b_account_id'],
-                               'type'                          => $mode));
+                               'type'                          => $mode,
+                               'required'                      => true
+                       ));
 
                        $ecodimb_data = 
$this->bocommon->initiate_ecodimb_lookup(array
                                (
@@ -2019,6 +2023,7 @@
                                'user_list'                                     
                        => array('options' => $user_list),
                                'status_list'                                   
                => $this->bo->select_status_list('select',$values['status']),
                                'status_name'                                   
                => 'values[status]',
+                               'status_required'                               
                => true,
                                'lang_no_status'                                
                => lang('Select status'),
                                'lang_status'                                   
                => lang('Status'),
                                'lang_status_statustext'                        
        => lang('What is the current status of this workorder ?'),

Modified: branches/dev-syncromind/property/js/portico/tts.add.js
===================================================================
--- branches/dev-syncromind/property/js/portico/tts.add.js      2015-04-16 
07:23:43 UTC (rev 13022)
+++ branches/dev-syncromind/property/js/portico/tts.add.js      2015-04-16 
11:21:19 UTC (rev 13023)
@@ -1,5 +1,21 @@
        this.confirm_session = function(action)
        {
+               if(action == 'save' || action == 'apply')
+               {
+                       conf = {
+                                       modules : 'location, date, security, 
file',
+                                       validateOnBlur : false,
+                                       scrollToTopOnError : true,
+                                       errorMessagePosition : 'top',
+                                       language : validateLanguage
+                               };
+                       var test =  $('form').validateForm(validateLanguage, 
conf);
+                       if(!test)
+                       {
+                               return;
+                       }
+               }
+
                var oArgs = {menuaction:'property.bocommon.confirm_session'};
                var strURL = phpGWLink('index.php', oArgs, true);
 

Modified: branches/dev-syncromind/property/js/portico/tts.view.js
===================================================================
--- branches/dev-syncromind/property/js/portico/tts.view.js     2015-04-16 
07:23:43 UTC (rev 13022)
+++ branches/dev-syncromind/property/js/portico/tts.view.js     2015-04-16 
11:21:19 UTC (rev 13023)
@@ -44,6 +44,22 @@
 
        this.confirm_session = function(action)
        {
+               if(action == 'save' || action == 'apply')
+               {
+                       conf = {
+                                       modules : 'location, date, security, 
file',
+                                       validateOnBlur : false,
+                                       scrollToTopOnError : true,
+                                       errorMessagePosition : 'top',
+                                       language : validateLanguage
+                               };
+                       var test =  $('form').validateForm(validateLanguage, 
conf);
+                       if(!test)
+                       {
+                               return;
+                       }
+               }
+
                var oArgs = {menuaction:'property.bocommon.confirm_session'};
                var strURL = phpGWLink('index.php', oArgs, true);
 

Modified: branches/dev-syncromind/property/js/portico/workorder.edit.js
===================================================================
--- branches/dev-syncromind/property/js/portico/workorder.edit.js       
2015-04-16 07:23:43 UTC (rev 13022)
+++ branches/dev-syncromind/property/js/portico/workorder.edit.js       
2015-04-16 11:21:19 UTC (rev 13023)
@@ -1,6 +1,50 @@
 
        var vendor_id;
 
+       this.validate_form = function()
+       {
+               conf = {
+                               modules : 'location, date, security, file',
+                               validateOnBlur : false,
+                               scrollToTopOnError : true,
+                               errorMessagePosition : 'top',
+                               language : validateLanguage
+                       };
+               return $('form').validateForm(validateLanguage, conf);
+       }
+
+       function submit_workorder()
+       {
+               if(!validate_form())
+               {
+                       return;
+               }
+               document.form.submit();
+       }
+
+       function calculate_workorder()
+       {
+               if(!validate_form())
+               {
+                       return;
+               }
+               document.getElementsByName("calculate_workorder")[0].value = 1;
+               document.form.submit();
+       }
+       function send_workorder()
+       {
+               if(!validate_form())
+               {
+                       return;
+               }
+               document.getElementsByName("send_workorder")[0].value = 1;
+               document.form.submit();
+       }
+       function set_tab(tab)
+       {
+               document.form.tab.value = tab;
+       }
+
        this.showlightbox_manual_invoide = function(workorder_id)
        {
                var oArgs = {menuaction:'property.uiworkorder.add_invoice', 
order_id:workorder_id};

Modified: branches/dev-syncromind/property/templates/base/condition_survey.xsl
===================================================================
--- branches/dev-syncromind/property/templates/base/condition_survey.xsl        
2015-04-16 07:23:43 UTC (rev 13022)
+++ branches/dev-syncromind/property/templates/base/condition_survey.xsl        
2015-04-16 11:21:19 UTC (rev 13023)
@@ -68,9 +68,13 @@
                             </label>
                             <xsl:choose>
                                 <xsl:when test="editable = 1">
-                                    <input id="title" name='values[title]' 
type="text" value="{survey/title}"
-                                                                       
data-validation="required"
-                                                                       
placeholder="title">
+                                    <input id="title" name='values[title]' 
type="text" value="{survey/title}">
+                                                                               
<xsl:attribute name="data-validation">
+                                                                               
        <xsl:text>required</xsl:text>
+                                                                               
</xsl:attribute>
+                                                                               
<xsl:attribute name="data-validation-error-msg">
+                                                                               
        <xsl:value-of select="php:function('lang', 'Please enter a title !')"/>
+                                                                               
</xsl:attribute>
                                     </input>
                                 </xsl:when>
                                 <xsl:otherwise>
@@ -85,8 +89,14 @@
                             </label>
                             <xsl:choose>
                                 <xsl:when test="editable = 1">
-                                                                       
<textarea id="descr" rows="6" style="width:40%; resize:none;" 
name="values[descr]" data-validation="required">
-                                                                               
<xsl:value-of select="survey/descr" disable-output-escaping="yes"/>
+                                                                       
<textarea id="descr" rows="6" style="width:40%; resize:none;" 
name="values[descr]">
+                                                                               
<xsl:attribute name="data-validation">
+                                                                               
        <xsl:text>required</xsl:text>
+                                                                               
</xsl:attribute>
+                                                                               
<xsl:attribute name="data-validation-error-msg">
+                                                                               
        <xsl:value-of select="php:function('lang', 'Please enter a description 
!')"/>
+                                                                               
</xsl:attribute>
+                                                                               
<xsl:value-of select="survey/descr" disable-output-escaping="yes"/>
                                                                        
</textarea>
                                 </xsl:when>
                                 <xsl:otherwise>
@@ -101,7 +111,13 @@
                             </label>
                             <xsl:choose>
                                 <xsl:when test="editable = 1">
-                                    <select id="cat_id" name="values[cat_id]" 
data-validation="required">
+                                    <select id="cat_id" name="values[cat_id]">
+                                                                               
<xsl:attribute name="data-validation">
+                                                                               
        <xsl:text>required</xsl:text>
+                                                                               
</xsl:attribute>
+                                                                               
<xsl:attribute name="data-validation-error-msg">
+                                                                               
        <xsl:value-of select="php:function('lang', 'Please enter a category 
!')"/>
+                                                                               
</xsl:attribute>
                                         <xsl:apply-templates 
select="categories/options"/>
                                     </select>
                                 </xsl:when>
@@ -121,9 +137,18 @@
                             </label>
                             <xsl:choose>
                                 <xsl:when test="editable = 1">
-                                    <input id="multiplier" 
name='values[multiplier]' type="text" value="{survey/multiplier}"
-                                                                       
data-validation="number" data-validation-allowing="float"/> 
-                                </xsl:when>
+                                    <input id="multiplier" 
name='values[multiplier]' type="text" value="{survey/multiplier}"> 
+                                                                               
<xsl:attribute name="data-validation">
+                                                                               
        <xsl:text>number</xsl:text>
+                                                                               
</xsl:attribute>
+                                                                               
<xsl:attribute name="data-validation-allowing">
+                                                                               
        <xsl:text>float</xsl:text>
+                                                                               
</xsl:attribute>
+                                                                               
<xsl:attribute name="data-validation-error-msg">
+                                                                               
        <xsl:value-of select="php:function('lang', 'Please enter a multiplier 
!')"/>
+                                                                               
</xsl:attribute>
+                                                                       </input>
+                                                               </xsl:when>
                                 <xsl:otherwise>
                                     <xsl:value-of select="survey/multiplier"/>
                                 </xsl:otherwise>
@@ -151,7 +176,13 @@
                             </label>
                             <xsl:choose>
                                 <xsl:when test="editable = 1">
-                                    <select id="status_id" 
name="values[status_id]" data-validation="required">
+                                    <select id="status_id" 
name="values[status_id]">
+                                                                               
<xsl:attribute name="data-validation">
+                                                                               
        <xsl:text>required</xsl:text>
+                                                                               
</xsl:attribute>
+                                                                               
<xsl:attribute name="data-validation-error-msg">
+                                                                               
        <xsl:value-of select="php:function('lang', 'Please enter a status !')"/>
+                                                                               
</xsl:attribute>
                                         <xsl:apply-templates 
select="status_list/options"/>
                                     </select>
                                 </xsl:when>

Modified: branches/dev-syncromind/property/templates/base/location_form.xsl
===================================================================
--- branches/dev-syncromind/property/templates/base/location_form.xsl   
2015-04-16 07:23:43 UTC (rev 13022)
+++ branches/dev-syncromind/property/templates/base/location_form.xsl   
2015-04-16 11:21:19 UTC (rev 13023)
@@ -23,18 +23,19 @@
                                        <xsl:attribute name="title">
                                                <xsl:value-of 
select="statustext"/>
                                        </xsl:attribute>
-                                       <xsl:choose>
-                                               <xsl:when test="readonly=1">
+                                               <xsl:if test="readonly=1">
                                                        <xsl:attribute 
name="readonly">
                                                                <xsl:text> 
readonly</xsl:text>
                                                        </xsl:attribute>
-                                               </xsl:when>
-                                               <xsl:when test="required='1'">
+                                               </xsl:if>
+                                               <xsl:if test="required='1'">
                                                        <xsl:attribute 
name="data-validation">
                                                                
<xsl:text>required</xsl:text>
                                                        </xsl:attribute>
-                                               </xsl:when>
-                                       </xsl:choose>
+                                                       <xsl:attribute 
name="data-validation-error-msg">
+                                                               <xsl:value-of 
select="php:function('lang', 'Please select a location !')"/>
+                                                       </xsl:attribute>
+                                               </xsl:if>
                                </input>
                                <xsl:for-each select="extra">
                                        <xsl:choose>

Modified: branches/dev-syncromind/property/templates/base/location_form2.xsl
===================================================================
--- branches/dev-syncromind/property/templates/base/location_form2.xsl  
2015-04-16 07:23:43 UTC (rev 13022)
+++ branches/dev-syncromind/property/templates/base/location_form2.xsl  
2015-04-16 11:21:19 UTC (rev 13023)
@@ -30,6 +30,9 @@
                                                                <xsl:attribute 
name="data-validation">
                                                                        
<xsl:text>number</xsl:text>
                                                                </xsl:attribute>
+                                                               <xsl:attribute 
name="data-validation-error-msg">
+                                                                       
<xsl:value-of select="php:function('lang', 'Please select a location !')"/>
+                                                               </xsl:attribute>
                                                        </xsl:if>
                                                </input>
                                        </xsl:when>

Modified: branches/dev-syncromind/property/templates/base/status_select.xsl
===================================================================
--- branches/dev-syncromind/property/templates/base/status_select.xsl   
2015-04-16 07:23:43 UTC (rev 13022)
+++ branches/dev-syncromind/property/templates/base/status_select.xsl   
2015-04-16 11:21:19 UTC (rev 13023)
@@ -1,5 +1,5 @@
   <!-- $Id$ -->
-       <xsl:template name="status_select">
+       <xsl:template name="status_select" xmlns:php="http://php.net/xsl";>
                <xsl:variable name="lang_status_statustext">
                        <xsl:value-of select="lang_status_statustext"/>
                </xsl:variable>
@@ -7,6 +7,14 @@
                        <xsl:value-of select="status_name"/>
                </xsl:variable>
                <select name="{$status_name}" class="forms" 
title="{$lang_status_statustext}">
+                       <xsl:if test="status_required='1'">
+                               <xsl:attribute name="data-validation">
+                                       <xsl:text>required</xsl:text>
+                               </xsl:attribute>
+                               <xsl:attribute name="data-validation-error-msg">
+                                       <xsl:value-of 
select="php:function('lang', 'Please select a status !')"/>
+                               </xsl:attribute>
+                       </xsl:if>
                        <option value="">
                                <xsl:value-of select="lang_no_status"/>
                        </option>

Modified: branches/dev-syncromind/property/templates/base/tts.xsl
===================================================================
--- branches/dev-syncromind/property/templates/base/tts.xsl     2015-04-16 
07:23:43 UTC (rev 13022)
+++ branches/dev-syncromind/property/templates/base/tts.xsl     2015-04-16 
11:21:19 UTC (rev 13023)
@@ -161,6 +161,13 @@
                                                        <xsl:attribute 
name="title">
                                                                <xsl:value-of 
select="php:function('lang', 'Enter the subject of this ticket')"/>
                                                        </xsl:attribute>
+                                                       <xsl:attribute 
name="data-validation">
+                                                               
<xsl:text>required</xsl:text>
+                                                       </xsl:attribute>
+                                                       <xsl:attribute 
name="data-validation-error-msg">
+                                                               <xsl:value-of 
select="php:function('lang', 'Please enter a title !')"/>
+                                                       </xsl:attribute>
+
                                                </input>
                                        </div>
                                        <div class="pure-control-group">
@@ -172,6 +179,12 @@
                                                        <xsl:attribute 
name="title">
                                                                <xsl:value-of 
select="php:function('lang', 'Enter the details of this ticket')"/>
                                                        </xsl:attribute>
+                                                       <xsl:attribute 
name="data-validation">
+                                                               
<xsl:text>required</xsl:text>
+                                                       </xsl:attribute>
+                                                       <xsl:attribute 
name="data-validation-error-msg">
+                                                               <xsl:value-of 
select="php:function('lang', 'Please give som details !')"/>
+                                                       </xsl:attribute>
                                                        <xsl:value-of 
select="value_details"/>
                                                </textarea>
                                        </div>
@@ -333,7 +346,7 @@
                                                </div>
                                        </xsl:for-each>
                                        <xsl:choose>
-                                               <xsl:when test="lookup_type 
='view'">
+                                               <xsl:when test="lookup_type 
='view2'">
                                                        <xsl:call-template 
name="location_view2"/>
                                                </xsl:when>
                                                <xsl:otherwise>

Modified: branches/dev-syncromind/property/templates/base/workorder.xsl
===================================================================
--- branches/dev-syncromind/property/templates/base/workorder.xsl       
2015-04-16 07:23:43 UTC (rev 13022)
+++ branches/dev-syncromind/property/templates/base/workorder.xsl       
2015-04-16 11:21:19 UTC (rev 13023)
@@ -80,23 +80,6 @@
                        <xsl:value-of select="lang_save"/>
                </xsl:variable>
 
-               <script type="text/javascript">
-                       function calculate_workorder()
-                       {
-                               
document.getElementsByName("calculate_workorder")[0].value = 1;
-                               document.form.submit();
-                       }
-                       function send_workorder()
-                       {
-                               
document.getElementsByName("send_workorder")[0].value = 1;
-                               document.form.submit();
-                       }
-                       function set_tab(tab)
-                       {
-                               document.form.tab.value = tab;                  
-                       }
-
-               </script>
                <table cellpadding="2" cellspacing="2" align="center">
                        <xsl:choose>
                                <xsl:when test="msgbox_data != ''">
@@ -116,7 +99,7 @@
                                                <table>
                                                        <tr height="50">
                                                                <td>
-                                                                       <input 
type="button" class="pure-button pure-button-primary" name="save" 
value="{$lang_save}" onClick="document.form.submit();">
+                                                                       <input 
type="button" class="pure-button pure-button-primary" name="save" 
value="{$lang_save}" onClick="submit_workorder();">
                                                                                
<xsl:attribute name="title">
                                                                                
        <xsl:value-of select="lang_save_statustext"/>
                                                                                
</xsl:attribute>

Modified: branches/dev-syncromind/property/templates/pure/b_account_form.xsl
===================================================================
--- branches/dev-syncromind/property/templates/pure/b_account_form.xsl  
2015-04-16 07:23:43 UTC (rev 13022)
+++ branches/dev-syncromind/property/templates/pure/b_account_form.xsl  
2015-04-16 11:21:19 UTC (rev 13023)
@@ -5,7 +5,7 @@
 </xsl:template>
 
 <!-- New template-->
-<xsl:template match="b_account_data">
+<xsl:template match="b_account_data" xmlns:php="http://php.net/xsl";>
        <script type="text/javascript">
                function b_account_lookup()
                {
@@ -35,14 +35,19 @@
                                        <xsl:attribute name="title">
                                                <xsl:value-of 
select="lang_select_b_account_help"/>
                                        </xsl:attribute>
+                                       <xsl:if test="required='1'">
+                                               <xsl:attribute 
name="data-validation">
+                                                       
<xsl:text>required</xsl:text>
+                                               </xsl:attribute>
+                                               <xsl:attribute 
name="data-validation-error-msg">
+                                                       <xsl:value-of 
select="php:function('lang', 'Please select a budget account !')"/>
+                                               </xsl:attribute>
+                                       </xsl:if>
                                </input>
                                <input size="30" type="text" 
name="b_account_name" value="{value_b_account_name}" 
onClick="b_account_lookup();" readonly="readonly">
                                        <xsl:attribute name="title">
                                                <xsl:value-of 
select="lang_select_b_account_help"/>
                                        </xsl:attribute>
-                                       <xsl:attribute name="data-validation">
-                                               <xsl:text>required</xsl:text>
-                                       </xsl:attribute>
                                </input>
                        </div>
                </xsl:otherwise>

Modified: branches/dev-syncromind/property/templates/pure/ecodimb_form.xsl
===================================================================
--- branches/dev-syncromind/property/templates/pure/ecodimb_form.xsl    
2015-04-16 07:23:43 UTC (rev 13022)
+++ branches/dev-syncromind/property/templates/pure/ecodimb_form.xsl    
2015-04-16 11:21:19 UTC (rev 13023)
@@ -5,7 +5,7 @@
 </xsl:template>
 
 <!-- New template-->
-<xsl:template match="ecodimb_data">
+<xsl:template match="ecodimb_data" xmlns:php="http://php.net/xsl";>
        <script type="text/javascript">
                function ecodimb_lookup()
                {
@@ -35,6 +35,14 @@
                                        <xsl:attribute name="title">
                                                <xsl:value-of 
select="lang_select_ecodimb_help"/>
                                        </xsl:attribute>
+                                       <xsl:if test="required='1'">
+                                               <xsl:attribute 
name="data-validation">
+                                                       
<xsl:text>required</xsl:text>
+                                               </xsl:attribute>
+                                               <xsl:attribute 
name="data-validation-error-msg">
+                                                       <xsl:value-of 
select="php:function('lang', 'Please select a value !')"/>
+                                               </xsl:attribute>
+                                       </xsl:if>
                                </input>
                                <input size="30" type="text" 
name="ecodimb_descr" value="{value_ecodimb_descr}" onClick="ecodimb_lookup();" 
readonly="readonly">
                                        <xsl:attribute name="title">

Modified: branches/dev-syncromind/property/templates/pure/vendor_form.xsl
===================================================================
--- branches/dev-syncromind/property/templates/pure/vendor_form.xsl     
2015-04-16 07:23:43 UTC (rev 13022)
+++ branches/dev-syncromind/property/templates/pure/vendor_form.xsl     
2015-04-16 11:21:19 UTC (rev 13023)
@@ -4,7 +4,7 @@
        </xsl:template>
 
        <!-- New template-->
-       <xsl:template match="vendor_data">
+       <xsl:template match="vendor_data" xmlns:php="http://php.net/xsl";>
                <script type="text/javascript">
                        function vendor_lookup()
                        {
@@ -22,6 +22,14 @@
                                        <xsl:attribute name="title">
                                                <xsl:value-of 
select="lang_select_vendor_help"/>
                                        </xsl:attribute>
+                                       <xsl:if test="required='1'">
+                                               <xsl:attribute 
name="data-validation">
+                                                       
<xsl:text>required</xsl:text>
+                                               </xsl:attribute>
+                                               <xsl:attribute 
name="data-validation-error-msg">
+                                                       <xsl:value-of 
select="php:function('lang', 'no vendor')"/>
+                                               </xsl:attribute>
+                                       </xsl:if>
                                </input>
                                <input size="30" type="text" name="vendor_name" 
value="{value_vendor_name}" onClick="vendor_lookup();" readonly="readonly">
                                        <xsl:attribute name="title">




reply via email to

[Prev in Thread] Current Thread [Next in Thread]