Expand my Community achievements bar.

Checkbox activation

Avatar

Level 2

I have a dropdownlist with 4 answers.

The first answer is the default and is visible.

On the right side of the dropdownlist I have a checkbox with a cross, that in default in not visible.

How can I achieve when a user picks answer 2,3 or 4 the cross appears in the checkbox.

In other words: Without changing the dropdownklist answers there is no cross,

when user picks answer 23 or 4 the cross is visible.

Thanks for your help!

5 Replies

Avatar

Level 10

Hi,

here's a script.

Put it into the layoutReady:event of your check box.

     this.rawValue = DropdownList1.rawValue === "Answer 2"? "1":"0";

Avatar

Level 2

I have tried that in the layoutReady:event in Javascript but that did not work, (with me)

Now I have done this:

--------------------------------------------------------------------------------------------

form1.#subform[0].DropDownList1::change - (JavaScript, client)

if

(DropDownList1.rawValue !=2)

{

CheckBox1.rawValue

=1

}

if

(DropDownList1.rawValue!=1)

{

CheckBox1.rawValue

=0;

}

---------------------------------------------------------------------------------------------

That seems to work fine, but only for dropdownlist choice 2 (seems logical sinde !=2)

There are two point left that I cannot manage to get OK:

1. How can I change the code so that the checkbox is crossed when dropbox answers 3 and 4 are given?

I have numbered the dropdownchoises to 1,2,3 and 4

So: 2,3 and 4 should lead to a crossed checkbox

2. How can I change the code so that the checkbox is not crossed when dropbox answers 1 is given?

even when the first choice was 2 or 3 or 4, when the user finally makes choice 1 the crossbox should not be crossed.

So

Dropboxchoice 1 - blank crossbox

Dropboxchoice 2 - crossed box

Dropboxchoice 3 - crossed box

Dropboxchoice 4 - crossed box

When returned to choice 0ne :

Dropboxchoice 1 - blank crossbox

Your help is  highly appreciated

Avatar

Level 10

Hi,

ok, I thought you have a check box for every single drop down value.

If there is only on then use:

this.rawValue = DropdownList1.rawValue !== "Answer 1"? "1":"0";

Avatar

Level 2

Razmar;

Could you please take a look at my file.

jan Willem

ps: reply to both emailsaddresses!

Avatar

Level 2

Problem solved, thank you and specially Razmar!