Hi all, we have grid components in our forms. as you know, if grid has

Hi all,
we have grid components in our forms.
as you know, if grid has some invalid fields, the whole column will be in error status after clicking submit button.
that is not very user-friendly, especially we have some customized validation, like length check.

is there a way to heighlight the invalid fields only?

fyi, we are using Appian6.71.

online waiting for you.
thank you very much.
...

OriginalPostID-91765

OriginalPostID-91765

  Discussion posts and replies are publicly visible

  • This is default behavior of a grid. This can be resolved by using java script.
  • hi thanigaivelr, thank you.
    btw, do you have any specific solutions?
    i have thought about the JS before.
    i tried to add a change event handler for the grid and manually do the validation for each field again.
  • Default behaviour is that if you call a java script function in validation it should validate a cell when you move from that cell to another. However if you click on submit button the entire column gets highlighted even if a single cell is invalid. You probably should be seeing this behaviour.
  • i'm using Appian6.71.
    it seems it is different from what you said.it will validate the whole column.
    maybe my JS code is not corrent.my current logic is if any cell in one column is invalid,then the field is invalid.
    could you please take a look at it?

    //this function is supposed to validate lenth
    //both ordinary text field and grid text field.
    function checkFieldLength(fieldId,length,isGrid){
              var value = window.FormAPI.getValue(fieldId).id.trim();
              
              //is grid field
              if(isGrid){
                        //value of grid field contains multiple values which are joined by ";"
                        var valueArr = value.split(";");
                        for(var i=0;i<valueArr.length;i++){
                                  valueArr[i] = valueArr[i].trim();
                                  
                                  //return false if any cell in the column is invalid
                                  if(valueArr[i] && valueArr[i].length > length){
                                            return false;
                                  }
                        }
              }else{
                        if(value && value.length > length){
                                  return false;
                        }
              }

              return true;
    }