Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

multi state check box

Avatar

Level 2

I am making a form and I want one checkbox and I want to be to click once for "check", click twice for "cross" and then click again for blank. Then if that is possible I would like to go one step further and if the checkbox is a "cross" then I would like it to make a text box red. Any help is appreciated. I have tried many things but nothing has worked.

1 Accepted Solution

Avatar

Correct answer by
Level 2

Awesome it worked. Even when I did a direct copy and paste from your document to my document it didn't work but then I copied my form to your document and it worked.

Thank you so much.

View solution in original post

23 Replies

Avatar

Level 2

No, I just want one check box that I can put change from "check' to 'cross' to neutral.

Avatar

Level 5

Sorry, yes I know.

First row is the first status.

Second row the second status.

Third row the third status.

You want tho have these three rows in one row.

That's what I mean.

Avatar

Level 5

I have to think about...

Different colors are not an option for you?

Avatar

Level 2

I would rather not but it could work.

Avatar

Level 5

It will works with the following:

Reference_Syntax.mark = "default | check | circle | cross | diamond | square | star"

Copy the script in the checkbox change-event:

if (NameOfCheckBox.resolveNode("ui.#checkButton").mark == "check")

{

     NameOfCheckBox.resolveNode("ui.#checkButton").mark = "cross";

     NameOfTextField.border.edge.color.value = "255,255,255";

}else if (NameOfCheckBox.resolveNode("ui.#checkButton").mark == "cross")

{

     NameOfCheckBox.rawValue == 0;

     NameOfTextField.border.edge.color.value = "245,245,0";

}else

{

     NameOfCheckBox.resolveNode("ui.#checkButton").mark = "check";

     NameOfTextField.border.edge.color.value = "255,255,255";

}

I hope it will helpful,

Mandy

Avatar

Level 5

There are a litte mistake, let me check it.

- First you have to give the TextField a border in white. Then will work the border script.

You can change the checkbox style but you have to save the current checkbox status in a variable...

Avatar

Level 5

I was wrong..you have to change under object "staes" in on/off/neutral and then we scripted with then binding:

if(this.rawValue ==1)

{

     //app.alert(this.rawValue);

     this.resolveNode("ui.#checkButton").mark = "check";

     Textfeld1.border.edge.color.value = "255,255,255";

}else if (this.rawValue == 0)

{

     //app.alert(this.rawValue);

     this.resolveNode("ui.#checkButton").mark = "cross";

     Textfeld1.border.edge.color.value = "245,245,0";

}else

{

     //app.alert(this.rawValue);

     this.rawValue == 0;

     Textfeld1.border.edge.color.value = "255,255,255";

}

There is a little mistake in the order. At the moment I don't see the mistake. Maybe it's too late. I have night in germany. Perhaps you can try a little bit.

At the moment first come is the cross, second come is the check, third is blank an a colored TextField..

I hope really it will helps you,

Mandy

Avatar

Level 2

I haven't be able to get it working yet. Do I have the object properties correct?

Field:

     States:On/Off/Neutral

     Check Style: Check

Value:

     Default: Off

Data Binding:

     On Value: 1

     Off Value: 0    

     Neutral Value: 2

First click I am getting a grey check, second click I am getting a black check and yellow border around the text box, third click blank, yellow border remains around text box.

Avatar

Level 2

Ignore my last response. I had seen your new post. I will try it and get back to you.

Avatar

Level 5

My result is:

First click - grey cross

second - black check

third - blank and a yellow border around the textbox

Avatar

Level 5

The javascript debugger gives me a syntax error.

Everything is ok when I change "this" in the Objectname of the checkbox.

Then the debugger is ok.

But the script works not correct.

For the first I got grey check - black check - blank and then grey cross - black check - blank

I have the same object properties.

Avatar

Level 8

Try this:

Put this in the mouseDown event of your check box:

if (this.rawValue==0){

this.resolveNode("ui.#checkButton").mark="check";

Textfield1.border.edge.color.value = "255,255,255";

}

else if (this.resolveNode("ui.#checkButton").mark=="check"){

this.resolveNode("ui.#checkButton").mark="cross";

Textfield1.border.edge.color.value = "255,0,0";

}

else{

this.resolveNode("ui.#checkButton").mark="check";

Textfield1.border.edge.color.value = "255,255,255";

}

mouseUp event:

if (this.resolveNode("ui.#checkButton").mark=="cross")

this.rawValue=1;

Kyle

Avatar

Level 2

I can't seem to get it working when I click it goes light grey cross, 2nd click black cross, 3rd click blank.

Avatar

Level 8

Oh right, make sure it is set to States: On/Off not On/Off/Neutral.

Kyle

Avatar

Level 2

Unfortunately still not working, now I get "cross" on first click, blank on second click. I can't figure out what is the problem the formula looks correct to me.

Avatar

Level 8

Make sure Check Style is Check.

Kyle