Expand my Community achievements bar.

SOLVED

Wht i am missing in this 'IF' condition logic?

Avatar

Level 8

Hello

Pls. help me that,

var myObject = /TextField11/

var greyFieldsList = "TextFieldAA TextFieldBB TextFieldCC "

var ReqFieldsList = "TextField11 TextField22 TextField33 "

var returnValue = greyFieldsList.search(myObject);

var returnValueReq = ReqFieldsList.search(myObject);

if (returnValue != -1) {
this.fillColor = "192,192,192"; //GREY
this.access    = "readOnly";
}
else if (returnValueReq != -1)
{
this.fillColor = "255,255,191";  //YELLOW
}
else
{
// do nothing
}

Yellow is not working at all!!

Grey is working some times, some times not!

Pls. correct my IF condition in such a way it shoud work.

At given point of time, any field possess only one color

Thank you

1 Accepted Solution

Avatar

Correct answer by
Level 2
Level 2

Hi,

Please debug your code by putting alerts in between the lines coz for me code is working fine.

app.alert(returnValue);

app.alert(returnValueReq);

Hope this helps.

View solution in original post

2 Replies

Avatar

Level 7

Sorry please ignore this post. I was thinking in FormCalc mode rather than javascript!

I don't know if this will solve your problem but you haven't put an endif to close your if statement. Also you don't need the else 'do nothing' part of the statement, if your variables do not meet the criteria then it won't enter either of the statements because you have an else if so you can get rid of the last part.

Message was edited by: whyisthisme

Avatar

Correct answer by
Level 2
Level 2

Hi,

Please debug your code by putting alerts in between the lines coz for me code is working fine.

app.alert(returnValue);

app.alert(returnValueReq);

Hope this helps.