Expand my Community achievements bar.

SOLVED

Creating choice rounds

Avatar

Level 2

Hallo all,

I'm designing an form and now I'm  a little stuck because it's my first form.

I've created the following thing like below, the originally text is deleted, and I want that if the user fill something in the red section, all input in the green section must be deleted. But if the user fills something in the green section, all input in the red section must be deleted en the choice round (or what it's called) must be selected.

Could someone tell me how I can do that?

Greetings,

Timo

Sorry for the bad English, I'm Dutch and have Dutch software

Formulier.jpg

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Timo,

Yes, I would recommend placing the script in the click event of the radio button group, rather than in the individual radio buttons. This means that you only have one script to maintain.

You can amend the script to get the functionality you want/need.

Good luck,

Niall

View solution in original post

6 Replies

Avatar

Level 10

Hi,

Here is a sample: https://acrobat.com/#d=m0KvkiLJ21tozfs4RXpIAQ

It does involve scripting. Have a look at the script in the click event of the radio button group. This is an if statement that looks at the rawValue of the radio button group and then sets the rawValue and access of the fields as appropriate.

Hope that helps,

Niall

Avatar

Level 2

Hallo Niall O'Donovan,

Thanks for the reply post! It's not what I was hoping, but it is a good alternative.

Only one more question in this case.

Where must I put that script? In the radio button group?

Greeting,

Timo

Avatar

Correct answer by
Level 10

Hi Timo,

Yes, I would recommend placing the script in the click event of the radio button group, rather than in the individual radio buttons. This means that you only have one script to maintain.

You can amend the script to get the functionality you want/need.

Good luck,

Niall

Avatar

Level 2

Okay,

Must I change the names of the field in your script to get it work?

This are the names of my field and buttons:

Upper section (red):

Radio button: "sectionA"

decimal box: "maandelijkse_storting"

date boxes: "begindatum" & "einddatum"

Lower section (green):

Radio button: "sectionB"

Selection boxes: "keuze1" & "keuze2" & "keuze3"

Maybe you can show me how the script must be.

greetings,

Timo

Avatar

Level 10

Hi Timo,

Yes, you need to use the references/names of your objects.

With the radio buttons you are testing against the value of the radio button GROUP, let's say it is named 'mySection'.

So the script in the click event of the radio button group would look something like this:

if (this.rawValue == 1)

{

     // open section A fields

     maandelijkse_storting.access = "open";

     begindatum.access = "open";

     einddatum.access = "open";


     // close Section B fields

     keuze1.rawValue = 0;

     keuze1.access = "readOnly";

     keuze2.rawValue = 0;

     keuze2.access = "readOnly";

     keuze3.rawValue = 0;

     keuze3.access = "readOnly";

}

else

{

     // close section A fields

     maandelijkse_storting.rawValue = null;

     maandelijkse_storting.access = "readOnly";

     begindatum.rawValue = null;

     begindatum.access = "readOnly";

     einddatum.rawValue = null;

     einddatum.access = "readOnly";

     

     // open Section B fields

     keuze1.access = "open";

     keuze2.access = "open";

     keuze3.access = "open";

}

This is a bit of guess work. When debugging a form you should use the Javascript Console (press Control+J when previewing the form or in Acrobat). Errors will show up here and you can address them in LC Designer.
Hope that helps,
Niall

Avatar

Level 2

Hello Niall,

Must I have Livecycle Designer ES2.5 for this scrip? If I put the script at the same place as you did in the exaple pdf, there's no error but it also doesn't work.

Greetings.

Timo

Edit://

I got it. There was an field with capital letter. I forgot that. Now it works.

Thanks!

topic closed

Thinking before Doing :S