AnsweredAssumed Answered

Alfresco Share text field Validation not working properly in Internet Explorer 8. Please help ?

Question asked by himanshu.sati09 on Jan 3, 2014
In our content model we have some fields/properties associated with contents/artifacts that are mandatory(*) and also have some "regex" pattern getting applied to it.
We want to highlight the text field's background with "red" color until user enters correct text in the respective field and color should changes to "white" on receiving correct text just to make edit properties page more intuitive.

for this we have added some code to the "alfresco/tomcat/webapps/share/js/form-runtime-min.js" file .


_validationEventFired: function(event, validation)
      {
         if (Alfresco.logger.isDebugEnabled())
            Alfresco.logger.debug("Event has been fired for field: " + validation.fieldId);
        
         var silent = false;
        
         // if dynamic updating is enabled
         if (this.showSubmitStateDynamically)
         {
            if (this.showSubmitStateDynamicallyErrors)
            {
               // if errors are being shown clear previous ones
               this._clearErrors();
            }
            else
            {
               // otherwise hide errors
               silent = true;
            }
         }
        
         // call handler
        
// Below code is added to change text field's background color to red or white on text validation.
var isValid = validation.handler(Event.getTarget(event), validation.args, event, this, silent, validation.message);
         if(!isValid) {
            Dom.get(validation.fieldId).style.backgroundColor = "red";
         } else {
            Dom.get(validation.fieldId).style.backgroundColor = "";
         }

        
         // update submit elements state, if required
         if (this.showSubmitStateDynamically)
         {
            this.updateSubmitElements();
         }
      },


The changes were working fine in IE 11 , Google chrome, Mozilla firefox browser but it is not working properly in IE8. In IE8 text fields background color changes only w.r.t mandatory validation and not w.r.t regex pattern validation.
Please help ??

Outcomes