Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

hex code for no color in colorField

Avatar

Avatar
Validate 10
Level 2
Shaheena_Sheikh
Level 2

Like

1 like

Total Posts

87 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Give Back
Boost 1
Applaud 5
View profile

Avatar
Validate 10
Level 2
Shaheena_Sheikh
Level 2

Like

1 like

Total Posts

87 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Give Back
Boost 1
Applaud 5
View profile
Shaheena_Sheikh
Level 2

26-01-2021

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

Screenshot (53).png

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

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
MVP
Anudeep_Garnepudi
MVP

Likes

271 likes

Total Posts

320 posts

Correct Reply

87 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile

Avatar
Establish
MVP
Anudeep_Garnepudi
MVP

Likes

271 likes

Total Posts

320 posts

Correct Reply

87 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile
Anudeep_Garnepudi
MVP

26-01-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) === "#"

Answers (0)