hex code for no color in colorField | Community
Skip to main content
Level 6
January 27, 2021
Solved

hex code for no color in colorField

  • January 27, 2021
  • 1 reply
  • 1163 views

I am using granite colorField and i have allowed no color option in its swatch. the title value pair for no color is :

the value is empty

In my js file, I need to check if no color option is selected. but the below code doesnt work:

selector: "[xyz]",
validate: function(el) {
var input = el.value;

if(input != "" && input != ''){

//task

}

whereas if I check using some hex code for color, then the if condition works fine. What is the code/way to check no color? I am using acs commons generic list to get color options

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Anudeep_Garnepudi

@shaheena_sheikh 

Try input.trim() !=== "" (if there is space in value property) if still not working then try to check the reverse condition input.charAt(0) === "#"

1 reply

Anudeep_Garnepudi
Community Advisor
Anudeep_GarnepudiCommunity AdvisorAccepted solution
Community Advisor
January 27, 2021

@shaheena_sheikh 

Try input.trim() !=== "" (if there is space in value property) if still not working then try to check the reverse condition input.charAt(0) === "#"

AG