fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [14433] update use of validator


From: Sigurd Nes
Subject: [Fmsystem-commits] [14433] update use of validator
Date: Fri, 20 Nov 2015 09:34:53 +0000

Revision: 14433
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14433
Author:   sigurdne
Date:     2015-11-20 09:34:53 +0000 (Fri, 20 Nov 2015)
Log Message:
-----------
update use of validator

Modified Paths:
--------------
    branches/dev-syncromind/booking/js/booking/application.js
    branches/dev-syncromind/booking/templates/base/application_new.xsl

Modified: branches/dev-syncromind/booking/js/booking/application.js
===================================================================
--- branches/dev-syncromind/booking/js/booking/application.js   2015-11-20 
09:31:32 UTC (rev 14432)
+++ branches/dev-syncromind/booking/js/booking/application.js   2015-11-20 
09:34:53 UTC (rev 14433)
@@ -110,7 +110,7 @@
 if ($.formUtils) {
     $.formUtils.addValidator({
         name: 'regulations_documents',
-        validatorFunction: function(value, $el, config, languaje, $form) {
+        validatorFunction: function(value, $el, config, language, $form) {
             var n = 0;
             $('#regulation_documents 
input[name="accepted_documents[]"]').each(function(){
                 if(!$(this).is(':checked')) {
@@ -121,12 +121,12 @@
             return v;
         },
         errorMessage: 'You must accept to follow all terms and conditions of 
lease first.',
-        errorMessageKey: ''
+        errorMessageKey: 'regulations_documents'
     })
 
     $.formUtils.addValidator({
         name: 'target_audience',
-        validatorFunction: function(value, $el, config, languaje, $form) {
+        validatorFunction: function(value, $el, config, language, $form) {
             var n = 0;
             $('#audience input[name="audience[]"]').each(function(){
                if ($(this).is(':checked')) {
@@ -137,12 +137,12 @@
             return v;
         },
         errorMessage: 'Please choose at least 1 target audience',
-        errorMessageKey: ''
+        errorMessageKey: 'target_audience'
     })
 
     $.formUtils.addValidator({
         name: 'number_participants',
-        validatorFunction: function(value, $el, config, languaje, $form) {
+        validatorFunction: function(value, $el, config, language, $form) {
             var n = 0;
             $('#agegroup_tbody input').each(function() {
                 if ($(this).val() != "" && $(this).val() > 0) {
@@ -153,12 +153,12 @@
             return v;
         },
         errorMessage: 'Number of participants is required',
-        errorMessageKey: ''
+        errorMessageKey: 'number_participants'
     });
 
     $.formUtils.addValidator({
         name: 'customer_identifier',
-        validatorFunction: function(value, $el, config, languaje, $form) {
+        validatorFunction: function(value, $el, config, language, $form) {
             var v = false;
             var customer_ssn = $('#field_customer_ssn').val();
             var customer_organization_number = 
$('#field_customer_organization_number').val();
@@ -168,12 +168,12 @@
             return v;
        },
        errorMessage: 'Customer identifier type is required',
-       errorMessageKey: ''
+       errorMessageKey: 'customer_identifier'
     });
 
     $.formUtils.addValidator({
         name: 'application_dates',
-        validatorFunction: function(value, $el, config, languaje, $form) {
+        validatorFunction: function(value, $el, config, language, $form) {
             var n = 0;
             if ($('input[name="from_[]"]').length == 0 || 
$('input[name="from_[]"]').length == 0) {
                 return false;
@@ -198,7 +198,7 @@
             return v;
         },
         errorMessage: 'Invalida date',
-        errorMessageKey: ''
+        errorMessageKey: 'application_dates'
     });
 } else {
     function validate_documents() {

Modified: branches/dev-syncromind/booking/templates/base/application_new.xsl
===================================================================
--- branches/dev-syncromind/booking/templates/base/application_new.xsl  
2015-11-20 09:31:32 UTC (rev 14432)
+++ branches/dev-syncromind/booking/templates/base/application_new.xsl  
2015-11-20 09:34:53 UTC (rev 14433)
@@ -27,6 +27,10 @@
                                     <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 an activity')"/>
+                                                                       
</xsl:attribute>
+
                                     <option value=""><xsl:value-of 
select="php:function('lang', '-- select an activity --')" /></option>
                                     <xsl:for-each select="activities">
                                         <option>
@@ -48,6 +52,9 @@
                                     <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="application/description"/>
                                 </textarea>
                             </div>
@@ -60,7 +67,11 @@
                                 <p><xsl:value-of 
select="config/application_howmany"/></p>
                             </xsl:if>
                             <label><xsl:value-of select="php:function('lang', 
'Estimated number of participants')" /></label>
-                            <input type="hidden" 
data-validation="number_participants"></input>
+                            <input type="hidden" 
data-validation="number_participants">
+                                                               <xsl:attribute 
name="data-validation-error-msg">
+                                                                       
<xsl:value-of select="php:function('lang', 'Number of participants is 
required')"/>
+                                                               </xsl:attribute>
+                                                       </input>
                             <table id="agegroup" class="pure-table 
pure-table-bordered">
                                 <thead>
                                     <tr>
@@ -114,6 +125,9 @@
                                     <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 building name')"/>
+                                                                       
</xsl:attribute>
                                 </input>
                                 <div id="building_container"></div>
                             </div>
@@ -240,7 +254,10 @@
                                     <xsl:attribute name="data-validation">
                                         <xsl:text>required</xsl:text>
                                     </xsl:attribute>
-                                    <xsl:attribute name="value"><xsl:value-of 
select="application/contact_name"/></xsl:attribute>
+                                                                       
<xsl:attribute name="data-validation-error-msg">
+                                                                               
<xsl:value-of select="php:function('lang', 'Enter a name')"/>
+                                                                       
</xsl:attribute>
+                                                                       
<xsl:attribute name="value"><xsl:value-of 
select="application/contact_name"/></xsl:attribute>
                                 </input>
                             </div>
                             <div class="pure-control-group">
@@ -249,7 +266,10 @@
                                     <xsl:attribute name="data-validation">
                                         <xsl:text>required</xsl:text>
                                     </xsl:attribute>
-                                    <xsl:attribute name="value"><xsl:value-of 
select="application/contact_email"/></xsl:attribute>
+                                                                       
<xsl:attribute name="data-validation-error-msg">
+                                                                               
<xsl:value-of select="php:function('lang', 'Enter an email')"/>
+                                                                       
</xsl:attribute>
+                                   <xsl:attribute name="value"><xsl:value-of 
select="application/contact_email"/></xsl:attribute>
                                 </input>
                             </div>
                             <div class="pure-control-group">
@@ -262,7 +282,7 @@
                                         <xsl:text>contact_email</xsl:text>
                                     </xsl:attribute>
                                     <xsl:attribute 
name="data-validation-error-msg">
-                                        <xsl:text>the e-mail addresses you 
entered do not match</xsl:text>
+                                                                               
<xsl:value-of select="php:function('lang', 'the e-mail addresses you entered 
does not match')"/>
                                     </xsl:attribute>
                                     <xsl:attribute name="value"><xsl:value-of 
select="application/contact_email2"/></xsl:attribute>
                                 </input>
@@ -343,5 +363,6 @@
         var initialAudience = <xsl:value-of 
select="application/audience_json"/>;
         var lang = <xsl:value-of select="php:function('js_lang', 'From', 'To', 
'Resource Type', 'Name', 'Accepted', 'Document', 'You must accept to follow all 
terms and conditions of lease first.')"/>
         
$('#field_customer_identifier_type').attr("data-validation","customer_identifier");
+        
$('#field_customer_identifier_type').attr("data-validation-error-msg","<xsl:value-of
 select="php:function('lang', 'Customer identifier type is required')"/>");
     </script>
 </xsl:template>




reply via email to

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