This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Jan 26, 2016, 2:30 PM
10 Posts

Change field color back to original when it is valid

  • Category: Other
  • Platform: Windows
  • Release: 9.0.1
  • Role: Developer
  • Tags:
  • Replies: 1

Hello,

The following JavaScript code changes the field's background color and border color if it is invalid for fields that are required and were not filled in.   It works as expected when I submit the form without entering a value in the required field.  I was hoping to add code to change the field back to normal after the user submits the form and the field has a value.  However, I still would like to change the other required field if they were left blank.

I apologize in advance if I don't make any sense.  Let me know if I need to explain things further.

The following code is in a JavaScript library.

XSP.validationError= function validationError(clientId,message) {

hidePleaseWait();

this.error(message);

var e = this.getElementById(clientId);

if(e!=null) {

e.style.background = "lightyellow";

e.style.border = "1px solid red";

if(e.select){

e.select();

}

if(e.focus){

e.focus();

}

}

}

 

 

Jan 30, 2016, 7:32 PM
453 Posts
An Idea

If I understand the problem correctly I think you need to do an else on the if(e!=null)

something like 

if (e!=null) {

//is invalid set field colors

}else{

//is valid revert to original color

}

 


This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal